Create release PR for new minor version #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create release PR | |
| run-name: Create release PR for new ${{ github.event.inputs.version }} version | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| required: true | |
| type: choice | |
| description: 'What type of release is this' | |
| options: | |
| - 'major' | |
| - 'minor' | |
| - 'patch' | |
| jobs: | |
| create-release-pr: | |
| name: Create release PR | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| VERSION: '' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.22.x' | |
| cache-dependency-path: ${{ github.workspace }}/src/go.sum | |
| - name: Set new beta version | |
| if: ${{ vars.RELEASE_NAME == 'parallels-desktop-beta' }} | |
| run: | | |
| UPDATED_VERSION=$(./.github/workflow_scripts/increment-version.sh -t ${{ inputs.version }} -f VERSION) | |
| MAJOR_VERSION=${UPDATED_VERSION%.*} | |
| NEW_VERSION=${UPDATED_VERSION%.*}.${{ github.run_id }} | |
| echo "VERSION=${NEW_VERSION}" >> "$GITHUB_ENV" | |
| echo "MAJOR_VERSION=${MAJOR_VERSION}" >> "$GITHUB_ENV" | |
| - name: Set new version | |
| if: ${{ vars.RELEASE_NAME == 'parallels-desktop' }} | |
| run: | | |
| NEW_VERSION=$(./.github/workflow_scripts/increment-version.sh -t ${{ inputs.version }} -f VERSION) | |
| echo "VERSION=${NEW_VERSION}" >> "$GITHUB_ENV" | |
| - name: Bump version and push | |
| env: | |
| GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }} | |
| VERSION: ${{ env.VERSION }} | |
| run: | | |
| git config --global user.email "cjlapao@gmail.com" | |
| git config --global user.name "cjlapao" | |
| echo "$VERSION" > ./VERSION | |
| git checkout -b release/"$VERSION" | |
| # Generate changelog for the new version | |
| ./.github/workflow_scripts/generate-changelog.sh --repo ${{ github.repository }} --version $VERSION | |
| git add VERSION CHANGELOG.md | |
| git commit -m "Release extension version $VERSION" | |
| git push --set-upstream origin release/$VERSION | |
| - name: Generate beta release notes | |
| if: ${{ vars.RELEASE_NAME == 'parallels-desktop-beta' }} | |
| run: | | |
| ./.github/workflow_scripts/get-latest-beta-changelog.sh --repo ${{ github.repository }} --output-to-file --version "${{ env.VERSION }}" | |
| cat release_notes.md | |
| env: | |
| GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }} | |
| - name: Generate release notes | |
| if: ${{ vars.RELEASE_NAME == 'parallels-desktop' }} | |
| run: | | |
| ./.github/workflow_scripts/get-latest-changelog.sh --output-to-file | |
| cat release_notes.md | |
| env: | |
| GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }} | |
| - name: Create PR | |
| run: | | |
| gh pr create \ | |
| --title "Release version ${{ env.VERSION }}" \ | |
| --body-file release_notes.md \ | |
| --base main \ | |
| --head release/${{ env.VERSION }} | |
| gh pr edit --add-label release-request | |
| env: | |
| GH_TOKEN: ${{ secrets.PARALLELS_WORKFLOW_PAT }} |