diff --git a/.github/actions/deploy.yml b/.github/actions/deploy.yml new file mode 100644 index 000000000..c541fdc80 --- /dev/null +++ b/.github/actions/deploy.yml @@ -0,0 +1,60 @@ +name: deploy + +inputs: + branch: + required: true + type: string + +runs: + using: composite + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: deploy + fetch-depth: 0 + + - name: Setup git + run: | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + name: ${{ matrix.branch }} + + - name: Copy artifacts + run: | + mv -f artifacts/app-release.apk ${{ matrix.branch }}/app-release.apk + mv -f artifacts/app-debug.apk ${{ matrix.branch }}/app-debug.apk + mv -f artifacts/stub-release.apk ${{ matrix.branch }}/stub-release.apk + rm -r artifacts + + - name: Run helper script + run: | + git checkout origin/ci-management releasehelper.sh + chmod +x releasehelper.sh + ./releasehelper.sh ${{ matrix.branch }} + mv -f ${{ matrix.branch }}.json docs + mv -f note.md ${{ matrix.branch }}/note.md + rm releasehelper.sh + + - name: Commit update + run: | + git restore --staged . + git add ${{ matrix.branch }}/app-release.apk + git add ${{ matrix.branch }}/app-debug.apk + git add ${{ matrix.branch }}/stub-release.apk + git add ${{ matrix.branch }}/note.md + git add docs/${{ matrix.branch }}.json + git commit --amend -m "Update ${{ matrix.branch }} ${{ env.VERSION }}" + + - name: Push result + uses: ad-m/github-push-action@v0.8.0 + with: + branch: deploy + force_with_lease: true + github_token: ${{ secrets.GITHUB_TOKEN }} + repository: ${{ github.repository }} diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 2cc62255a..c19212949 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -6,11 +6,16 @@ on: branch: required: true type: string + outputs: + changed: + value: ${{ jobs.automerge.outputs.changed }} jobs: automerge: name: Automerge ${{ inputs.branch }} runs-on: ubuntu-latest + outputs: + changed: ${{ steps.rebase.outputs.changed }} steps: - name: Checkout diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba2cbd7d6..cee7278a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,7 @@ jobs: branch: madness build-stable: needs: automerge-stable + if: needs.automerge-stable.outputs.changed == 'true' uses: ./.github/workflows/build.yml with: branch: stable @@ -36,6 +37,7 @@ jobs: KEYSTORE_KEY: ${{ secrets.KEYSTORE_KEY }} build-beta: needs: automerge-beta + if: needs.automerge-beta.outputs.changed == 'true' uses: ./.github/workflows/build.yml with: branch: beta @@ -44,6 +46,7 @@ jobs: KEYSTORE_KEY: ${{ secrets.KEYSTORE_KEY }} build-canary: needs: automerge-canary + if: needs.automerge-canary.outputs.changed == 'true' uses: ./.github/workflows/build.yml with: branch: canary @@ -52,6 +55,7 @@ jobs: KEYSTORE_KEY: ${{ secrets.KEYSTORE_KEY }} build-madness: needs: automerge-madness + if: needs.automerge-madness.outputs.changed == 'true' uses: ./.github/workflows/build.yml with: branch: madness @@ -61,4 +65,15 @@ jobs: deploy: if: always() needs: [build-stable, build-beta, build-canary, build-madness] - uses: ./.github/workflows/deploy.yml + runs-on: ubuntu-latest + strategy: + matrix: + branch: [ stable, beta, canary, madness ] + fail-fast: false + max-parallel: 1 + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/deploy.yml + if: needs[format('build-{0}', matrix.branch)].outputs.changed == 'true' + with: + branch: ${{ matrix.branch }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 8c8cb6424..000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: deploy - -on: - workflow_call: - -jobs: - deploy: - runs-on: ubuntu-latest - - strategy: - matrix: - branch: [ stable, beta, canary, madness ] - fail-fast: false - max-parallel: 1 - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: deploy - fetch-depth: 0 - - - name: Setup git - run: | - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - path: artifacts - name: ${{ matrix.branch }} - - - name: Copy artifacts - run: | - mv -f artifacts/app-release.apk ${{ matrix.branch }}/app-release.apk - mv -f artifacts/app-debug.apk ${{ matrix.branch }}/app-debug.apk - mv -f artifacts/stub-release.apk ${{ matrix.branch }}/stub-release.apk - rm -r artifacts - - - name: Run helper script - run: | - git checkout origin/ci-management releasehelper.sh - chmod +x releasehelper.sh - ./releasehelper.sh ${{ matrix.branch }} - mv -f ${{ matrix.branch }}.json docs - mv -f note.md ${{ matrix.branch }}/note.md - rm releasehelper.sh - - - name: Commit update - run: | - git restore --staged . - git add ${{ matrix.branch }}/app-release.apk - git add ${{ matrix.branch }}/app-debug.apk - git add ${{ matrix.branch }}/stub-release.apk - git add ${{ matrix.branch }}/note.md - git add docs/${{ matrix.branch }}.json - git commit --amend -m "Update ${{ matrix.branch }} ${{ env.VERSION }}" - - - name: Push result - uses: ad-m/github-push-action@v0.8.0 - with: - branch: deploy - force: true - github_token: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.repository }}