fix: npm publish job #11
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: Publish Package | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' # Trigger on version tags, e.g., v1.0.0 | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read # Allows checking out the repository code | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| # registry-url: 'https://registry.npmjs.org' # Specifies the npm registry | |
| - run: npm ci | |
| - run: npm run build --if-present | |
| - run: npm test | |
| - run: | | |
| rm -f .npmrc | |
| unset NODE_AUTH_TOKEN; unset NPM_TOKEN # Unset the default token set by "actions/setup-node" to get OIDC publishing working | |
| npm publish # The npm CLI automatically uses the OIDC token | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: Release v${{ steps.version.outputs.version }} | |
| body: | | |
| ## Release v${{ steps.version.outputs.version }} | |
| 🎉 This version has been automatically published to NPM! | |
| 📦 **NPM Package**: https://www.npmjs.com/package/hyper-marked/v/${{ steps.version.outputs.version }} | |
| ### Installation | |
| ```bash | |
| npm install hyper-marked@${{ steps.version.outputs.version }} | |
| ``` | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |