Publish to npm #2
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 to npm | |
on: | |
workflow_dispatch: | |
jobs: | |
publish-npm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: master | |
- name: Merge develop to master | |
run: | | |
git fetch --quiet | |
git reset --hard origin/master | |
git merge --ff-only --quiet origin/develop | |
- name: Use cache for root node_modules | |
id: cache-root-node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: root-node_modules-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('package-lock.json') }} | |
- name: Install | |
if: steps.cache-root-node_modules.outputs.cache-hit != 'true' | |
run: npm ci --no-audit --no-fund | |
- name: Publish | |
run: npx semantic-release | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update develop | |
run: | | |
git push origin master:develop --quiet > /dev/null 2>&1 |