github action #6
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: Node.js Package Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'admin/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm install | |
working-directory: ./admin | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 20 | |
- name: Inject GitHub and npm tokens into .npmrc | |
run: | | |
sed -i "s/\${GH_TOKEN}/${{ secrets.GH_TOKEN }}/" .npmrc | |
sed -i "s/\${NPM_TOKEN}/${{ secrets.NPM_TOKEN }}/" .npmrc | |
- name: Publish to npm | |
run: npm publish | |
working-directory: ./admin | |
- name: Publish to GitHub Packages | |
run: npm publish --registry=https://npm.pkg.github.com/ | |
working-directory: ./admin |