Publish to npm #1
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: | |
| - '*' # Matches all tags like 1.2.3 | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org/' | |
| - name: Extract version from tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" | |
| - name: Generate package.json | |
| run: | | |
| cat > package.json <<EOF | |
| { | |
| "name": "fixi.js", | |
| "version": "${{ steps.get_version.outputs.VERSION }}", | |
| "description": "fixi.js - A Small Generalized Hypermedia Controls Tool", | |
| "main": "surreal.js", | |
| "files": [ | |
| "fixi.js", | |
| "README.md" | |
| ], | |
| "repository": { | |
| "type": "git", | |
| "url": "https://github.com/bigskysoftware/fixi.git" | |
| }, | |
| "author": "1cg", | |
| "license": "BSD-0", | |
| "keywords": [ | |
| "fixi", | |
| "htmx", | |
| "hypermedia", | |
| "fetch", | |
| "html" | |
| ], | |
| "bugs": { | |
| "url": "https://github.com/bigskysoftware/fixi/issues" | |
| } | |
| } | |
| EOF | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |