|
| 1 | +name: "Draft New Release" |
| 2 | + |
| 3 | +on: |
| 4 | + repository_dispatch: |
| 5 | + types: [draft-new-release] |
| 6 | + |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: "The release version" |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + draft_new_release: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + packages: write |
| 19 | + actions: write |
| 20 | + pull-requests: write |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Setup yq |
| 26 | + uses: dcarbone/install-yq-action@v1.1.1 |
| 27 | + with: |
| 28 | + version: "v4.42.1" |
| 29 | + force: true |
| 30 | + |
| 31 | + - name: Initialize mandatory git config |
| 32 | + run: | |
| 33 | + git config user.name "GitHub Actions" |
| 34 | + git config user.email noreply@github.com |
| 35 | +
|
| 36 | + - name: Determine release version |
| 37 | + id: set-version |
| 38 | + run: | |
| 39 | + echo "RELEASE_VERSION=${{ github.event.client_payload.version || github.event.inputs.version }}" >> $GITHUB_ENV |
| 40 | +
|
| 41 | + - name: Create release branch |
| 42 | + run: git checkout -b release/${{ env.RELEASE_VERSION }} |
| 43 | + |
| 44 | + - name: Update changelog |
| 45 | + uses: thomaseizinger/keep-a-changelog-new-release@1.1.0 |
| 46 | + with: |
| 47 | + version: ${{ env.RELEASE_VERSION }} |
| 48 | + |
| 49 | + - name : Bump version in CITATION.cff |
| 50 | + run: | |
| 51 | + yq -i '.version="${{ env.RELEASE_VERSION }}"' CITATION.cff |
| 52 | +
|
| 53 | + - name: Commit changes |
| 54 | + id: make-commit |
| 55 | + run: | |
| 56 | + git add CHANGELOG.md CITATION.cff |
| 57 | + git commit --message "ci: prepare release ${{ env.RELEASE_VERSION }}" |
| 58 | + echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT |
| 59 | +
|
| 60 | + - name: Push new branch |
| 61 | + run: git push origin release/${{ env.RELEASE_VERSION }} |
| 62 | + |
| 63 | + - name: Create pull request |
| 64 | + uses: thomaseizinger/create-pull-request@1.4.0 |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + with: |
| 68 | + head: release/${{ env.RELEASE_VERSION }} |
| 69 | + base: main |
| 70 | + title: Release version ${{ env.RELEASE_VERSION }} |
| 71 | + reviewers: ${{ github.actor }} |
| 72 | + body: | |
| 73 | + Hi @${{ github.actor }}! 👋 |
| 74 | +
|
| 75 | + This PR was created in response to a trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}. |
| 76 | + I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}. |
| 77 | +
|
| 78 | + Merging this PR will create a GitHub release and upload any assets that are created as part of the release build. |
| 79 | +
|
| 80 | +
|
0 commit comments