Closed evanplaice closed 4 years ago
Setup CD to dual-publish to both NPM and GitHub Packages
name: Release on: push: tags: - 'v*' jobs: check: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@master - name: Setup uses: actions/setup-node@v1 with: node-version: 13.2 - name: Cache uses: actions/cache@v1 with: path: node_modules key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.OS }}-npm-cache- - name: Verify run: | npm ci npm run preversion npm: runs-on: ubuntu-latest needs: check steps: - name: Checkout uses: actions/checkout@master - name: Publish run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc npm publish --access public gh: runs-on: ubuntu-latest needs: check steps: - name: Checkout uses: actions/checkout@master - name: Publish run: | echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc ORG="$(echo '${{ github.repository }}' | cut -d'/' -f1)" echo "registry=https://npm.pkg.github.com/$ORG" > .npmrc npm publish
Setup CD to dual-publish to both NPM and GitHub Packages
Checklist
Notes
References