Publish to npm #5
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 | |
| # Triggered by ci.yml after tagging, or manually for retries. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to publish (e.g. v1.2.7)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.x | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| - name: Build project | |
| run: npm run build | |
| - name: Publish to npm (OIDC trusted publisher) | |
| run: npx -y npm@latest publish --provenance --access public | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: publish | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.x | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project (dist files for release assets) | |
| run: npm run build | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.tag }} | |
| generate_release_notes: true | |
| files: | | |
| dist/quikdown.umd.min.js | |
| dist/quikdown.esm.min.js | |
| dist/quikdown.cjs | |
| dist/quikdown_bd.umd.min.js | |
| dist/quikdown_bd.esm.min.js | |
| dist/quikdown_edit.umd.min.js | |
| dist/quikdown.light.min.css | |
| dist/quikdown.dark.min.css |