Version Bump #1
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: Version Bump | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump_type: | |
| description: 'Version bump type' | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| bump-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Bump version | |
| id: bump | |
| run: | | |
| # Get current version from root package.json | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| echo "Current version: $CURRENT_VERSION" | |
| # Bump version based on input | |
| npm version ${{ github.event.inputs.bump_type }} --no-git-tag-version | |
| # Get new version | |
| NEW_VERSION=$(node -p "require('./package.json').version") | |
| echo "New version: $NEW_VERSION" | |
| echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| # Update all package versions | |
| cd packages/shared | |
| npm version $NEW_VERSION --no-git-tag-version | |
| cd ../core | |
| npm version $NEW_VERSION --no-git-tag-version | |
| cd ../cli | |
| npm version $NEW_VERSION --no-git-tag-version | |
| cd ../.. | |
| # Update dependency versions in package.json files | |
| sed -i "s/\"@jetstart\/shared\": \".*\"/\"@jetstart\/shared\": \"$NEW_VERSION\"/" packages/core/package.json | |
| sed -i "s/\"@jetstart\/shared\": \".*\"/\"@jetstart\/shared\": \"$NEW_VERSION\"/" packages/cli/package.json | |
| - name: Commit version changes | |
| run: | | |
| git add . | |
| git commit -m "chore(release): v${{ steps.bump.outputs.version }}" | |
| git tag -a "v${{ steps.bump.outputs.version }}" -m "Release v${{ steps.bump.outputs.version }}" | |
| git push origin master | |
| git push origin "v${{ steps.bump.outputs.version }}" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.bump.outputs.version }} | |
| name: Release v${{ steps.bump.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true |