Prepare Release #2
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: Prepare Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump: | |
| description: Release bump | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| date: | |
| description: Release date in YYYY-MM-DD format. Defaults to today. | |
| required: false | |
| type: string | |
| permissions: {} | |
| jobs: | |
| prepare-release: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| token: ${{ secrets.FASTAPI_VSCODE_LATEST_CHANGES }} # zizmor: ignore[secrets-outside-env] | |
| persist-credentials: true | |
| - name: Prepare release | |
| env: | |
| BUMP: ${{ inputs.bump }} | |
| DATE: ${{ inputs.date }} | |
| run: node scripts/prepare-release.mjs prepare "$BUMP" "$DATE" | |
| - name: Get release version | |
| id: release-version | |
| run: | | |
| set -euo pipefail | |
| version="$(node scripts/prepare-release.mjs current-version)" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Create release pull request | |
| env: | |
| GH_TOKEN: ${{ secrets.FASTAPI_VSCODE_LATEST_CHANGES }} | |
| VERSION: ${{ steps.release-version.outputs.version }} | |
| run: | | |
| set -euo pipefail | |
| branch="release-${VERSION}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git switch -c "$branch" | |
| git add package.json CHANGELOG.md | |
| git commit -m "π Release version ${VERSION}" | |
| git push --set-upstream origin "$branch" | |
| gh pr create \ | |
| --base main \ | |
| --head "$branch" \ | |
| --title "π Release version ${VERSION}" \ | |
| --body "Prepare release ${VERSION}." \ | |
| --label release |