Release #111
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
| # yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json | |
| --- | |
| name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: 'Type of version bump' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| name: Create release | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install node 24 | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Configure git | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| - name: Update package with new version | |
| id: bump | |
| run: | | |
| # Get base version (remove -ea suffix if present, handles both -ea. and -ea- formats) | |
| BASE_VERSION=$(node -p "require('./package.json').version" | sed -E 's/-ea[.-][0-9]+$//') | |
| # Bump the version | |
| NEW_VERSION=$(npm version ${{ inputs.version_type }} --no-git-tag-version | sed 's/v//') | |
| echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Install project modules | |
| run: npm ci | |
| - name: Create release branch | |
| run: | | |
| BRANCH="release/v${{ steps.bump.outputs.version }}" | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| git checkout -b "$BRANCH" | |
| git add package.json | |
| git add package-lock.json | |
| git commit -m "build: release ${{ steps.bump.outputs.version }} [skip ci]" | |
| git push origin "$BRANCH" | |
| echo "$BRANCH" > releasebranch.txt | |
| - uses: actions/upload-artifact@v5 | |
| with: | |
| name: releasebranch | |
| path: releasebranch.txt | |
| - name: Create GitHub release tag | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: "Release ${{ steps.bump.outputs.version }}" | |
| tag_name: "v${{ steps.bump.outputs.version }}" | |
| target_commitish: "release/v${{ steps.bump.outputs.version }}" | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Pull Request for release + next version | |
| run: | | |
| gh pr create \ | |
| --title "build: release ${{ steps.bump.outputs.version }}" \ | |
| --body "build: release ${{ steps.bump.outputs.version }}" \ | |
| --base main \ | |
| --head "release/v${{ steps.bump.outputs.version }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |