diff --git a/.github/workflows/bot-auto-merge-reconcile.yml b/.github/workflows/bot-auto-merge-reconcile.yml index d82f759f5..26ddf53a1 100644 --- a/.github/workflows/bot-auto-merge-reconcile.yml +++ b/.github/workflows/bot-auto-merge-reconcile.yml @@ -20,7 +20,7 @@ jobs: uses: actions/create-github-app-token@v3 with: private-key: ${{ secrets.RENOVATE_APPROVE_PRIVATE_KEY }} - client-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }} + app-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }} permission-pull-requests: write # required to enable auto-merge - name: Install GitHub CLI diff --git a/.github/workflows/bot-pr-automerge.yml b/.github/workflows/bot-pr-automerge.yml index 35c5461fa..f1e531bc2 100644 --- a/.github/workflows/bot-pr-automerge.yml +++ b/.github/workflows/bot-pr-automerge.yml @@ -28,7 +28,7 @@ jobs: uses: actions/create-github-app-token@v3 with: private-key: ${{ secrets.RENOVATE_APPROVE_PRIVATE_KEY }} - client-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }} + app-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }} permission-pull-requests: write # required to approve a pull request and enable auto-merge - name: Install GitHub CLI diff --git a/.github/workflows/crowdin-schedule-download.yml b/.github/workflows/crowdin-schedule-download.yml index 22cb2b943..7b783f4e5 100644 --- a/.github/workflows/crowdin-schedule-download.yml +++ b/.github/workflows/crowdin-schedule-download.yml @@ -22,7 +22,7 @@ jobs: uses: actions/create-github-app-token@v3 with: private-key: ${{ secrets.CROWDIN_APP_PRIVATE_KEY }} - client-id: ${{ secrets.CROWDIN_APP_ID }} + app-id: ${{ secrets.CROWDIN_APP_ID }} permission-contents: write # required to commit to crowdin branch permission-pull-requests: write # required to create pull request diff --git a/.github/workflows/deployment-beta-release.yml b/.github/workflows/deployment-beta-release.yml index ba3bde3a2..0f0725bef 100644 --- a/.github/workflows/deployment-beta-release.yml +++ b/.github/workflows/deployment-beta-release.yml @@ -52,7 +52,7 @@ jobs: uses: actions/create-github-app-token@v3 with: private-key: ${{ secrets.RENOVATE_APPROVE_PRIVATE_KEY }} - client-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }} + app-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }} permission-pull-requests: write - name: Approve PR env: @@ -64,7 +64,7 @@ jobs: uses: actions/create-github-app-token@v3 with: private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }} - client-id: ${{ secrets.RENOVATE_MERGE_APP_ID }} + app-id: ${{ secrets.RENOVATE_MERGE_APP_ID }} permission-contents: write # write to beta branch (due to merge) permission-pull-requests: write # merge pull request - id: automerge diff --git a/.github/workflows/deployment-docker-image.yml b/.github/workflows/deployment-docker-image.yml index 14135e7f8..6f8483132 100644 --- a/.github/workflows/deployment-docker-image.yml +++ b/.github/workflows/deployment-docker-image.yml @@ -40,6 +40,7 @@ jobs: version: ${{ steps.read-semver.outputs.version || steps.version-fallback.outputs.version }} git_ref: ${{ steps.read-git-ref.outputs.ref || steps.read-semver.outputs.version || github.ref }} skipped: ${{ env.SKIP_RELEASE }} + upstream_sync: ${{ steps.update-upstream.outcome }} steps: - run: echo "Manual dispatch redeploys the latest existing release without creating a new one" if: env.SKIP_RELEASE == 'true' @@ -54,7 +55,7 @@ jobs: uses: actions/create-github-app-token@v3 with: private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }} - client-id: ${{ secrets.RENOVATE_MERGE_APP_ID }} + app-id: ${{ secrets.RENOVATE_MERGE_APP_ID }} permission-contents: write # required to commit package.json & changelog changes, merge them to dev / next and publish the release - uses: actions/checkout@v7 @@ -115,8 +116,10 @@ jobs: run: | echo "ref=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - name: Update dev / next branch + id: update-upstream if: env.SKIP_RELEASE == 'false' - continue-on-error: true # Prevent pipeline from failing when merge fails + # Finish publishing the already-created release, then fail in the publish job if synchronization did not work. + continue-on-error: true env: GITHUB_TOKEN: ${{ steps.obtainToken.outputs.token }} UPSTREAM_BRANCH: ${{ github.ref_name == 'main' && 'dev' || 'next' }} @@ -274,7 +277,7 @@ jobs: uses: actions/create-github-app-token@v3 with: private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }} - client-id: ${{ secrets.RENOVATE_MERGE_APP_ID }} + app-id: ${{ secrets.RENOVATE_MERGE_APP_ID }} permission-contents: write # required to publish the release - name: Log in to the Container registry @@ -311,6 +314,12 @@ jobs: run: | gh release edit --repo ${{ github.repository }} ${{ needs.release.outputs.version }} --draft=false + - name: Verify dev / next synchronization + if: needs.release.outputs.skipped == 'false' && needs.release.outputs.upstream_sync != 'success' + run: | + echo "::error::The released commit was not synchronized back to the upstream development branch." + exit 1 + - name: Discord notification if: github.event_name != 'workflow_dispatch' || inputs['send-notifications'] env: @@ -318,3 +327,17 @@ jobs: uses: Ilshidur/action-discord@0.4.0 with: args: "Successfully deployed images for branch **${{ github.ref_name }}**. Tagged as **${{env.NEXT_VERSION}}**." + + notify-failure: + name: Notify deployment failure + if: ${{ always() && (failure() || cancelled()) && (github.event_name != 'workflow_dispatch' || inputs['send-notifications']) }} + needs: [release, build-amd64, build-arm64, extract-asset-amd64, extract-asset-arm64, publish] + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: Discord failure notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@0.4.0 + with: + args: "The deployment for branch **${{ github.ref_name }}** failed or was cancelled: [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" diff --git a/.github/workflows/deployment-weekly-release.yml b/.github/workflows/deployment-weekly-release.yml index cafa7b30d..b08b0c08c 100644 --- a/.github/workflows/deployment-weekly-release.yml +++ b/.github/workflows/deployment-weekly-release.yml @@ -19,10 +19,10 @@ permissions: jobs: create-and-merge-pr: runs-on: ubuntu-latest - timeout-minutes: 2 + timeout-minutes: 10 steps: - name: Discord notification - if: ${{ github.event.inputs.send-notifications }} + if: ${{ github.event_name == 'schedule' || inputs.send-notifications }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@0.4.0 @@ -38,13 +38,30 @@ jobs: with: token: ${{ github.token }} branch: dev + noNewCommitBehavior: silent + noVersionBumpBehavior: silent + - name: No release needed + if: ${{ steps.semver.outputs.bump == '' || steps.semver.outputs.bump == 'none' }} + run: echo "No release-worthy commits were found since ${{ steps.semver.outputs.current }}." >> "$GITHUB_STEP_SUMMARY" - name: Create pull request id: create-pull-request - run: 'gh pr create --title "chore(release): automatic release ${{ steps.semver.outputs.next }}" --body "**This is an automatic release**.
Manual action may be required for major bumps.
Detected change to be ``${{ steps.semver.outputs.bump }}``
Bump version from ``${{ steps.semver.outputs.current }}`` to ``${{ steps.semver.outputs.next }}``" --base main --head dev --label automerge' + if: ${{ steps.semver.outputs.bump != '' && steps.semver.outputs.bump != 'none' }} + run: | + pr_url="$(gh pr list --base main --head dev --state open --json url --jq '.[0].url // empty')" + if [[ -z "$pr_url" ]]; then + pr_url="$(gh pr create \ + --title "chore(release): automatic release ${{ steps.semver.outputs.next }}" \ + --body "**This is an automatic release**.
Manual action may be required for major bumps.
Detected change to be ``${{ steps.semver.outputs.bump }}``
Bump version from ``${{ steps.semver.outputs.current }}`` to ``${{ steps.semver.outputs.next }}``" \ + --base main \ + --head dev \ + --label automerge)" + fi + echo "url=$pr_url" >> "$GITHUB_OUTPUT" + echo "pr_number=${pr_url##*/}" >> "$GITHUB_OUTPUT" env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - name: Discord notification - if: ${{ github.event.inputs.send-notifications }} + if: ${{ steps.create-pull-request.outcome == 'success' && (github.event_name == 'schedule' || inputs.send-notifications) }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@0.4.0 @@ -52,26 +69,29 @@ jobs: args: "Created a release PR ${{ steps.create-pull-request.outputs.url }} for version ${{ steps.semver.outputs.next }} (new behaviour: ${{ steps.semver.outputs.bump }})" - name: Obtain token id: obtainApprovalToken + if: ${{ steps.create-pull-request.outcome == 'success' }} uses: actions/create-github-app-token@v3 with: private-key: ${{ secrets.RENOVATE_APPROVE_PRIVATE_KEY }} - client-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }} + app-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }} permission-pull-requests: write - name: Approve PR + if: ${{ steps.create-pull-request.outcome == 'success' }} env: GITHUB_TOKEN: ${{ steps.obtainApprovalToken.outputs.token }} run: | - gh pr review --approve --body "Automatically approved by GitHub Action" + gh pr review "${{ steps.create-pull-request.outputs.url }}" --approve --body "Automatically approved by GitHub Action" - name: Obtain token id: obtainMergeToken + if: ${{ steps.create-pull-request.outcome == 'success' }} uses: actions/create-github-app-token@v3 with: private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }} - client-id: ${{ secrets.RENOVATE_MERGE_APP_ID }} + app-id: ${{ secrets.RENOVATE_MERGE_APP_ID }} permission-contents: write # write to main branch (due to merge) permission-pull-requests: write # merge pull request - id: automerge - if: ${{ steps.semver.outputs.bump != 'major' }} + if: ${{ steps.create-pull-request.outcome == 'success' && steps.semver.outputs.bump != 'major' }} name: automerge uses: "pascalgn/automerge-action@v0.16.4" env: @@ -85,21 +105,21 @@ jobs: MERGE_REQUIRED_APPROVALS: 0 # do not require approvals - name: Merged Discord notification - if: ${{ steps.automerge.outputs.mergeResult == 'merged' && github.event.inputs.send-notifications }} + if: ${{ steps.automerge.outputs.mergeResult == 'merged' && (github.event_name == 'schedule' || inputs.send-notifications) }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@0.4.0 with: args: "Merged PR ${{ steps.create-pull-request.outputs.url }} for release ${{ steps.semver.outputs.next }}" - name: Major Bump Discord notification - if: ${{ steps.semver.outputs.bump == 'major' && github.event.inputs.send-notifications }} + if: ${{ steps.semver.outputs.bump == 'major' && (github.event_name == 'schedule' || inputs.send-notifications) }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@0.4.0 with: args: "The release PR must be manually merged because the next version is a major version: ${{ steps.create-pull-request.outputs.url }} for release ${{ steps.semver.outputs.next }}" - name: Discord Fail Notification - if: failure() && github.event.inputs.send-notifications + if: ${{ failure() && (github.event_name == 'schedule' || inputs.send-notifications) }} env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} uses: Ilshidur/action-discord@0.4.0 diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 644f4a74d..80a94bd1f 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -5,39 +5,6 @@ on: types: [released] jobs: - trigger-docs-release: - name: Trigger Documentation Release - runs-on: ubuntu-latest - timeout-minutes: 2 - steps: - - name: Obtain token - id: obtainToken - uses: actions/create-github-app-token@v3 - with: - private-key: ${{ secrets.HOMARR_DOCS_RELEASE_APP_PRIVATE_KEY }} - client-id: ${{ vars.HOMARR_DOCS_RELEASE_APP_ID }} - owner: homarr-labs - repositories: | - documentation - permission-contents: write # required to dispatch repository workflow - - name: Trigger documentation release - env: - GITHUB_TOKEN: ${{ steps.obtainToken.outputs.token }} - SOURCE_TAG: ${{ github.event.release.tag_name }} - run: | - curl -X POST \ - -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github+json" \ - https://api.github.com/repos/homarr-labs/documentation/dispatches \ - -d @- <