Publish NPM #118
Workflow file for this run
This file contains 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 NPM" | |
on: | |
push: | |
tags: | |
- "v\\d+\\.\\d+\\.\\d+" | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node_version: [18, 20] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node_version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- run: npm run ci-test | |
- run: npx codecov | |
try-publish-npm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- run: pnpm install | |
- run: npm run build | |
try-publish-create-halsp: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- run: pnpm install | |
- run: npm run build:create-halsp | |
publish-npm: | |
if: github.repository == 'halsp/cli' | |
needs: [test, try-publish-npm, try-publish-create-halsp] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- run: pnpm install | |
- run: npm run build | |
- run: npm publish --access=public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
publish-create-halsp: | |
if: github.repository == 'halsp/cli' | |
needs: [test, try-publish-npm, try-publish-create-halsp] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- run: pnpm install | |
- run: npm run build:create-halsp | |
- run: npm publish --access=public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
sync-cnpm: | |
if: github.repository == 'halsp/core' | |
needs: [publish-npm, publish-create-halsp] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: sh scripts/sync-cnpm.sh |