Make Release #38
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
| # This workflow creates a new release from the HEAD of the 'develop' branch. | |
| # The branch is merged into 'main' and a release is created using the version | |
| # number that was inputted when the workflow was triggered. | |
| # Once the release is created, a PR to merge 'develop_dependencies'->'develop' | |
| # is created, this reminds us to update our dependencies for the next | |
| # development cycle. | |
| name: Make Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| type: string | |
| description: "New semantic version string" | |
| required: true | |
| draft: | |
| type: boolean | |
| description: "Create draft release" | |
| default: false | |
| open_dependencies_pr: | |
| type: boolean | |
| default: false | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.FPPF_BOT_AUTH_KEY }} | |
| - name: Permissions Check | |
| uses: ./.github/workflows/actions/permission_check | |
| with: | |
| token: ${{ secrets.FPPF_BOT_AUTH_KEY }} | |
| - name: Validate | |
| id: validate | |
| run: | | |
| # Check, and format, input version | |
| pip install packaging | |
| VERSION="$(python -c "from packaging import version; print(version.Version(\"${{ github.event.inputs.version }}\"))")" | |
| TAG="v${VERSION}" | |
| # Check the tag doesn't already exist | |
| if gh release view "${TAG}" &> /dev/null; then | |
| echo "Release with tag '${TAG}' already exists."; | |
| exit 1; | |
| fi | |
| echo tag=${TAG} >> $GITHUB_OUTPUT | |
| - name: Update main | |
| id: update-main | |
| run: | | |
| git config user.email "[email protected]" | |
| git config user.name "fppf-bot" | |
| git fetch origin main | |
| git checkout main | |
| # The 'Checkout' action performs a shallow checkout of develop. | |
| # We need the history in order to do the merge with main. | |
| git fetch origin develop --unshallow | |
| git merge origin/develop --ff-only | |
| git push origin main:main | |
| - name: Create release | |
| id: create-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.FPPF_BOT_AUTH_KEY }} | |
| DRAFT: ${{ inputs.draft && '--draft' || '' }} | |
| run: | | |
| gh release create "${{ steps.validate.outputs.tag }}" \ | |
| --generate-notes \ | |
| --target main \ | |
| ${DRAFT} | |
| - name: Open develop_dependencies PR | |
| if: ${{ inputs.open_dependencies_pr && !inputs.draft }} | |
| uses: ./.github/workflows/actions/dependencies_PR | |
| with: | |
| token: ${{ secrets.FPPF_BOT_AUTH_KEY }} | |
| tag: ${{ steps.validate.outputs.tag }} |