|
| 1 | +name: "Merge release to master" |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 5 | + cancel-in-progress: false |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: ["release-*"] |
| 9 | + workflow_dispatch: {} |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | +jobs: |
| 13 | + release: |
| 14 | + runs-on: ubuntu-24.04 |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 17 | + with: |
| 18 | + ref: "master" |
| 19 | + fetch-depth: 0 |
| 20 | + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 |
| 21 | + with: |
| 22 | + go-version-file: go.mod |
| 23 | + - uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3 |
| 24 | + env: |
| 25 | + GITHUB_TOKEN: ${{ github.token }} |
| 26 | + MISE_DISABLE_TOOLS: "clang-format,golangci-lint,skaffold" |
| 27 | + - run: | |
| 28 | + git config --global user.email "110050114+kumahq[bot]@users.noreply.github.com" |
| 29 | + git config --global user.name "kumahq[bot]" |
| 30 | + - id: latest-branch |
| 31 | + run: | |
| 32 | + echo "branch=$(make dev/print-latest-release-branch)" >> $GITHUB_OUTPUT |
| 33 | + - run: | |
| 34 | + if [[ "refs/heads/${{ steps.latest-branch.outputs.branch }}" == "${{ github.ref }}" ]]; then |
| 35 | + make dev/merge-release |
| 36 | + fi |
| 37 | + - id: commit-changes |
| 38 | + run: | |
| 39 | + git status |
| 40 | + # "git merge HEAD" is the way to check if merge is in progress |
| 41 | + if git merge HEAD &> /dev/null; then |
| 42 | + echo "skipping commit" |
| 43 | + echo "changes=skipped" >> $GITHUB_OUTPUT |
| 44 | + else |
| 45 | + echo "commit changes" |
| 46 | + git commit -s -m "chore(merge): ${{ steps.latest-branch.outputs.branch }} branch to master" |
| 47 | + echo "changes=committed" >> $GITHUB_OUTPUT |
| 48 | + fi |
| 49 | + - name: Generate GitHub app token |
| 50 | + id: github-app-token |
| 51 | + uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 |
| 52 | + with: |
| 53 | + app-id: ${{ secrets.APP_ID }} |
| 54 | + private-key: ${{ secrets.APP_PRIVATE_KEY }} |
| 55 | + - name: "Create Pull Request" |
| 56 | + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 |
| 57 | + if: steps.commit-changes.outputs.changes == 'committed' |
| 58 | + with: |
| 59 | + commit-message: "chore(merge): ${{ steps.latest-branch.outputs.branch }} branch to master" |
| 60 | + signoff: true |
| 61 | + branch: chore/merge-release-to-master |
| 62 | + base: master |
| 63 | + delete-branch: true |
| 64 | + title: "chore(merge): ${{ steps.latest-branch.outputs.branch }} branch to master" |
| 65 | + draft: false |
| 66 | + token: ${{ steps.github-app-token.outputs.token }} |
| 67 | + committer: kumahq[bot] <110050114+kumahq[bot]@users.noreply.github.com> |
| 68 | + author: kumahq[bot] <110050114+kumahq[bot]@users.noreply.github.com> |
| 69 | + body: | |
| 70 | + **Do NOT squash on merging.** Allow merge commit first in the [repository settings](https://github.com/${{ github.repository }}/settings). |
| 71 | + |
| 72 | + Generated by [action](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) |
0 commit comments