1.1.0 #4
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: Publish to NPM | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/v} | |
| echo "version=$TAG" >> $GITHUB_OUTPUT | |
| echo "Version: $TAG" | |
| # - name: Update package.json version | |
| # run: | | |
| # npm version ${{ steps.version.outputs.version }} --no-git-tag-version | |
| - name: Verify version matches tag | |
| run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| TAG_VERSION=${{ steps.version.outputs.version }} | |
| if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then | |
| echo "Error: Package version ($PACKAGE_VERSION) doesn't match tag version ($TAG_VERSION)" | |
| exit 1 | |
| fi | |
| echo "Version verification passed: $PACKAGE_VERSION" | |
| - name: Publish to NPM | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_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 }} |