v0.1.0 #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 | |
| # Publishes create-startup-api to npm when a GitHub Release is published. | |
| # Create a release whose tag matches the package version (e.g. v0.0.1) — the | |
| # workflow verifies the two agree before publishing. Can also be run manually. | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write # required for npm provenance | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Smoke-check sources | |
| run: | | |
| node --check index.js | |
| node --check template/scripts/sync-assets.mjs | |
| - name: Verify tag matches package version | |
| if: github.event_name == 'release' | |
| run: | | |
| PKG_VERSION="v$(node -p "require('./package.json').version")" | |
| TAG="${GITHUB_REF_NAME}" | |
| if [ "$PKG_VERSION" != "$TAG" ]; then | |
| echo "::error::Release tag ($TAG) does not match package version ($PKG_VERSION)." | |
| exit 1 | |
| fi | |
| - name: Publish to npm | |
| run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |