|
| 1 | +name: Draft new release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: The version you want to release. Must be a valid semver version. |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + |
| 11 | +jobs: |
| 12 | + draft-new-release: |
| 13 | + if: startsWith(github.event.inputs.version, 'v') |
| 14 | + name: Draft a new release |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + pull-requests: write |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout code |
| 22 | + uses: actions/checkout@v3 |
| 23 | + |
| 24 | + - name: Create release branch |
| 25 | + run: git checkout -b release/${{ github.event.inputs.version }} |
| 26 | + |
| 27 | + - name: Update changelog |
| 28 | + uses: thomaseizinger/[email protected] |
| 29 | + with: |
| 30 | + version: ${{ github.event.inputs.version }} |
| 31 | + |
| 32 | + - name: Initialize mandatory git config |
| 33 | + run: | |
| 34 | + git config user.name "GitHub Actions" |
| 35 | + git config user.email [email protected] |
| 36 | +
|
| 37 | + - name: Bump version |
| 38 | + run: npm version ${{ github.event.inputs.version }} --git-tag-version false |
| 39 | + |
| 40 | + - name: Commit changelog and manifest files |
| 41 | + id: make-commit |
| 42 | + run: | |
| 43 | + git add CHANGELOG.md package.json package-lock.json |
| 44 | + git commit --message "Prepare release ${{ github.event.inputs.version }}" |
| 45 | + echo "::set-output name=commit::$(git rev-parse HEAD)" |
| 46 | + |
| 47 | + - name: Push new branch |
| 48 | + run: git push origin release/${{ github.event.inputs.version }} |
| 49 | + |
| 50 | + - name: Create pull request for master |
| 51 | + uses: thomaseizinger/[email protected] |
| 52 | + env: |
| 53 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + with: |
| 55 | + head: release/${{ github.event.inputs.version }} |
| 56 | + base: master |
| 57 | + title: "Release version ${{ github.event.inputs.version }}" |
| 58 | + reviewers: ${{ github.actor }} |
| 59 | + body: | |
| 60 | + Hi @${{ github.actor }}! |
| 61 | +
|
| 62 | + This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}. |
| 63 | + I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}. |
| 64 | +
|
| 65 | + - name: Create pull request for develop |
| 66 | + uses: thomaseizinger/[email protected] |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + with: |
| 70 | + head: release/${{ github.event.inputs.version }} |
| 71 | + base: develop |
| 72 | + title: "Release version ${{ github.event.inputs.version }}" |
| 73 | + reviewers: ${{ github.actor }} |
| 74 | + body: | |
| 75 | + Hi @${{ github.actor }}! |
| 76 | +
|
| 77 | + This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}. |
| 78 | + I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}. |
0 commit comments