|
| 1 | +name: Finalize Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + type: string |
| 8 | + required: true |
| 9 | + description: "Release version without v prefix (e.g. 6.1.2)" |
| 10 | + runPostRelease: |
| 11 | + type: boolean |
| 12 | + default: true |
| 13 | + description: "Run post-release snapshot bump (post-release.sh)" |
| 14 | + publishProducts: |
| 15 | + type: boolean |
| 16 | + default: true |
| 17 | + description: "Publish products and update site" |
| 18 | + buildWindows: |
| 19 | + type: boolean |
| 20 | + default: true |
| 21 | + description: "Build and publish Windows installer" |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: publish-${{ github.ref }} |
| 25 | + cancel-in-progress: false |
| 26 | + |
| 27 | +jobs: |
| 28 | + verify-tag: |
| 29 | + name: Verify release tag |
| 30 | + runs-on: ubuntu-latest |
| 31 | + if: github.repository_owner == 'halestudio' |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 35 | + with: |
| 36 | + fetch-depth: 0 |
| 37 | + |
| 38 | + - name: Verify release tag exists |
| 39 | + run: | |
| 40 | + if ! git rev-parse --verify "refs/tags/v${{ inputs.version }}" > /dev/null 2>&1; then |
| 41 | + echo "Error: Tag v${{ inputs.version }} does not exist" |
| 42 | + exit 1 |
| 43 | + fi |
| 44 | + echo "Tag v${{ inputs.version }} verified" |
| 45 | +
|
| 46 | + post-release: |
| 47 | + name: Post-release snapshot bump |
| 48 | + needs: [verify-tag] |
| 49 | + if: ${{ inputs.runPostRelease }} |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - name: Determine app token for release |
| 53 | + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 |
| 54 | + id: app-token |
| 55 | + with: |
| 56 | + app-id: ${{ secrets.WE_RELEASE_GITHUB_APP_ID }} |
| 57 | + private-key: "${{ secrets.WE_RELEASE_GITHUB_PRIVATE_KEY }}" |
| 58 | + |
| 59 | + - name: Setup Maven |
| 60 | + uses: s4u/setup-maven-action@ba34de01b7f4ba2ab8e2860df8993a29f4477056 # v1.20.0 |
| 61 | + with: |
| 62 | + java-version: 17 |
| 63 | + java-distribution: temurin |
| 64 | + maven-version: 3.9.6 |
| 65 | + checkout-fetch-depth: 0 |
| 66 | + checkout-token: ${{ steps.app-token.outputs.token }} |
| 67 | + checkout-persist-credentials: true |
| 68 | + |
| 69 | + - name: Verify running on default branch |
| 70 | + env: |
| 71 | + GH_TOKEN: ${{ github.token }} |
| 72 | + run: | |
| 73 | + default=$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name) |
| 74 | + if [ "${{ github.ref_name }}" != "$default" ]; then |
| 75 | + echo "Error: post-release snapshot bump must run on the default branch ($default), got ${{ github.ref_name }}" |
| 76 | + exit 1 |
| 77 | + fi |
| 78 | +
|
| 79 | + - name: Set Git identity |
| 80 | + run: | |
| 81 | + git config user.name "wetransform Bot" |
| 82 | + git config user.email "113353961+wetransformer@users.noreply.github.com" |
| 83 | +
|
| 84 | + - name: Run post-release script |
| 85 | + run: ./build/post-release.sh |
| 86 | + |
| 87 | + - name: Notify failure to Slack |
| 88 | + if: failure() |
| 89 | + env: |
| 90 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} |
| 91 | + uses: voxmedia/github-action-slack-notify-build@3665186a8c1a022b28a1dbe0954e73aa9081ea9e # v1.6.0 |
| 92 | + with: |
| 93 | + channel: build-failures |
| 94 | + status: FAILED |
| 95 | + color: danger |
| 96 | + |
| 97 | + publish-products: |
| 98 | + name: Publish products and update site |
| 99 | + needs: [verify-tag] |
| 100 | + if: ${{ inputs.publishProducts }} |
| 101 | + uses: ./.github/workflows/publish-products.yml |
| 102 | + with: |
| 103 | + version: ${{ inputs.version }} |
| 104 | + secrets: inherit |
| 105 | + |
| 106 | + windows-build: |
| 107 | + name: Build Windows installer |
| 108 | + needs: [verify-tag] |
| 109 | + if: ${{ inputs.buildWindows }} |
| 110 | + uses: ./.github/workflows/windows-build.yml |
| 111 | + with: |
| 112 | + version: ${{ inputs.version }} |
| 113 | + secrets: inherit |
0 commit comments