chore: release v0.1.41 #88
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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: "Version increment type" | |
| required: true | |
| default: "patch" | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| # Skip if commit message starts with "chore: release" (to avoid infinite loop) | |
| if: "github.event_name == 'workflow_dispatch' || !startsWith(github.event.head_commit.message || '', 'chore: release')" | |
| permissions: | |
| contents: write | |
| id-token: write # Required for npm OIDC trusted publishing | |
| steps: | |
| - uses: actions/create-github-app-token@v2 | |
| id: app-token | |
| with: | |
| app-id: ${{ secrets.RECCE_ACTION_BOT_APP_ID }} | |
| private-key: ${{ secrets.RECCE_ACTION_BOT_PRIVATE_KEY }} | |
| owner: ${{ github.repository_owner }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" # Node 24 includes npm 11+ with OIDC support | |
| cache: "pnpm" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Verify npm version | |
| run: | | |
| NPM_VERSION=$(npm --version) | |
| echo "npm version: $NPM_VERSION" | |
| # npm 11.5.1+ required for OIDC trusted publishing | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build package | |
| run: pnpm build | |
| - name: Type check | |
| run: pnpm type:check | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Bump version | |
| id: bump | |
| run: | | |
| # Read version from VERSION file | |
| OLD_VERSION=$(cat VERSION | tr -d '[:space:]') | |
| # Use input version_type for manual trigger, default to "patch" for push trigger | |
| VERSION_TYPE="${{ inputs.version_type || 'patch' }}" | |
| # Parse semver components | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$OLD_VERSION" | |
| # Bump version based on type | |
| case $VERSION_TYPE in | |
| major) | |
| MAJOR=$((MAJOR + 1)) | |
| MINOR=0 | |
| PATCH=0 | |
| ;; | |
| minor) | |
| MINOR=$((MINOR + 1)) | |
| PATCH=0 | |
| ;; | |
| patch) | |
| PATCH=$((PATCH + 1)) | |
| ;; | |
| esac | |
| NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}" | |
| # Write new version to VERSION file | |
| echo "$NEW_VERSION" > VERSION | |
| # Update package.json version | |
| node -e "const pkg = require('./package.json'); pkg.version = '$NEW_VERSION'; require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n')" | |
| echo "old_version=$OLD_VERSION" >> $GITHUB_OUTPUT | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "version_type=$VERSION_TYPE" >> $GITHUB_OUTPUT | |
| echo "Bumped version ($VERSION_TYPE) from $OLD_VERSION to $NEW_VERSION" | |
| - name: Commit version bump | |
| run: | | |
| git add VERSION package.json | |
| git commit -m "chore: release v${{ steps.bump.outputs.new_version }}" | |
| git tag "v${{ steps.bump.outputs.new_version }}" | |
| - name: Push changes | |
| run: | | |
| git push origin main | |
| git push origin "v${{ steps.bump.outputs.new_version }}" | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| # npm OIDC trusted publishing - no NPM_TOKEN required | |
| # Provenance attestation is automatic with trusted publishing | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.bump.outputs.new_version }} | |
| name: v${{ steps.bump.outputs.new_version }} | |
| body: | | |
| ## Changes | |
| Version bumped from v${{ steps.bump.outputs.old_version }} to v${{ steps.bump.outputs.new_version }} | |
| Install: | |
| ```bash | |
| npm install @datarecce/ui@${{ steps.bump.outputs.new_version }} | |
| ``` | |
| generate_release_notes: true |