From 51f19cc3891657950d1539aa18cf0d74a56bffc5 Mon Sep 17 00:00:00 2001 From: sitiom Date: Wed, 31 Aug 2022 10:52:50 +0800 Subject: [PATCH] ci: deploy to fly on push --- .github/workflows/fly.yml | 22 ++++++++++++++++++++++ .github/workflows/update-fork.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/fly.yml create mode 100644 .github/workflows/update-fork.yml diff --git a/.github/workflows/fly.yml b/.github/workflows/fly.yml new file mode 100644 index 0000000..87d1f0a --- /dev/null +++ b/.github/workflows/fly.yml @@ -0,0 +1,22 @@ +name: Deploy to Fly + +on: + push: + branches: ["main"] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Wait for other checks to succeed + uses: lewagon/wait-on-check-action@v1.3.1 + with: + ref: ${{ github.ref }} + running-workflow-name: deploy + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/checkout@v3 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --remote-only + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} diff --git a/.github/workflows/update-fork.yml b/.github/workflows/update-fork.yml new file mode 100644 index 0000000..288da43 --- /dev/null +++ b/.github/workflows/update-fork.yml @@ -0,0 +1,31 @@ +name: Update Fork + +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + auto-update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} # So that the workflow triggers on fork update + - uses: fregante/setup-git-user@v2 + - name: Check if fork is synced with upstream + id: check_sync + uses: MadLadSquad/check-for-synced-branches-action@v1.0.0.3 + with: + upstream-url: "https://github.com/iJSD-Org/IacDiscordNotifs" + first-branch: main + second-branch: main + - name: Rebase on top of base branch + if: steps.check_sync.outputs.behind > 0 + run: | + git remote add upstream https://github.com/iJSD-Org/IacDiscordNotifs + git fetch upstream + git rebase upstream/main + git commit --amend --no-edit + git push -f