Remove registry-url from setup-node to enable npm OIDC #10
Workflow file for this run
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: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 1.0.1 or patch/minor/major)' | |
| required: true | |
| default: 'patch' | |
| permissions: | |
| contents: write | |
| id-token: write # Required for npm trusted publishing (OIDC) | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm install | |
| - 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: version | |
| working-directory: packages/create-unmint | |
| run: | | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| # Extract version from tag (v1.0.1 -> 1.0.1) | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| else | |
| INPUT="${{ github.event.inputs.version }}" | |
| if [[ "$INPUT" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| VERSION="$INPUT" | |
| else | |
| # patch/minor/major - let npm calculate | |
| npm version "$INPUT" --no-git-tag-version | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| fi | |
| npm version "$VERSION" --no-git-tag-version | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| - name: Build CLI | |
| run: npm run build | |
| working-directory: packages/create-unmint | |
| - name: Commit version bump | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| git add packages/create-unmint/package.json | |
| git commit -m "Release v${{ steps.version.outputs.version }}" | |
| git tag "v${{ steps.version.outputs.version }}" | |
| git push origin main --tags | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| working-directory: packages/create-unmint | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| generate_release_notes: true | |
| body: | | |
| ## Installation | |
| ```bash | |
| npx create-unmint@${{ steps.version.outputs.version }} my-docs | |
| ``` | |
| See the [README](https://github.com/gregce/unmint#readme) for full documentation. |