|
| 1 | +name: "Draft new release" |
| 2 | + |
| 3 | +on: |
| 4 | + issues: |
| 5 | + types: [opened, labeled] |
| 6 | + |
| 7 | +jobs: |
| 8 | + draft-new-release: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + if: startsWith(github.event.issue.title, 'Release version') && contains(github.event.issue.labels.*.name, 'release') # only run for issues with a specific title and label |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + |
| 14 | + - name: Extract version from issue title |
| 15 | + run: | |
| 16 | + TITLE="${{ github.event.issue.title }}" |
| 17 | + VERSION=${TITLE#Release version } |
| 18 | +
|
| 19 | + echo "::set-env name=RELEASE_VERSION::$VERSION" |
| 20 | +
|
| 21 | + - name: Create release branch |
| 22 | + run: git checkout -b release/${{ env.RELEASE_VERSION }} |
| 23 | + |
| 24 | + - name: Update changelog |
| 25 | + uses: thomaseizinger/keep-a-changelog-new-release@master |
| 26 | + with: |
| 27 | + version: ${{ env.RELEASE_VERSION }} |
| 28 | + |
| 29 | + - name: Initialize mandatory git config |
| 30 | + run: | |
| 31 | + git config user.name "GitHub actions" |
| 32 | + git config user.email [email protected] |
| 33 | +
|
| 34 | + # This step will differ depending on your project setup |
| 35 | + - name: Bump version in package.json |
| 36 | + run: yarn version --new-version ${{ env.RELEASE_VERSION }} |
| 37 | + |
| 38 | + - name: Commit changelog and manifest files |
| 39 | + run: | |
| 40 | + git add CHANGELOG.md package.json |
| 41 | + git commit --message "Prepare release ${{ env.RELEASE_VERSION }}" |
| 42 | +
|
| 43 | + - name: Push new branch |
| 44 | + run: git push origin release/${{ env.RELEASE_VERSION }} |
| 45 | + |
| 46 | + - name: Create pull request |
| 47 | + uses: thomaseizinger/create-pull-request@v1 |
| 48 | + with: |
| 49 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + head: release/${{ env.RELEASE_VERSION }} |
| 51 | + base: master |
| 52 | + title: ${{ github.event.issue.title }} |
| 53 | + reviewers: ${{ github.event.issue.user.login }} |
| 54 | + body: | |
| 55 | + Resolves #${{ github.event.issue.number }} |
0 commit comments