Skip to content

Publish

Publish #6

Workflow file for this run

name: Publish
on:
workflow_run:
workflows: ["Release"]
branches: [main]
types: [completed]
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: "https://registry.npmjs.org"
- name: Update install script with current version
run: |
NEW_VERSION=$(node -pe "require('./package.json').version")
sed -i "s/%%VERSION%%/${NEW_VERSION}/g" ./scripts/install.js
cat ./scripts/install.js
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}