.github/workflows/publish-to-registry.yml
name: Publish to NPM registry
on:
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: artifacts
run: |
mkdir /tmp/output
mv -t /tmp/output lib typings README.md LICENSE package.json
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: /tmp/output
publish:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: artifacts
path: artifacts
- name: list
run: ls -R
working-directory: artifacts
- name: publish
run: npm publish ./artifacts/ --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- uses: geekyeggo/delete-artifact@v1
with:
name: artifacts