Skip to content

Instantly share code, notes, and snippets.

@akshay-nm
Last active April 5, 2021 19:12
Show Gist options
  • Save akshay-nm/4ee7f666bd72a4ba37ee87a4523972bd to your computer and use it in GitHub Desktop.
Save akshay-nm/4ee7f666bd72a4ba37ee87a4523972bd to your computer and use it in GitHub Desktop.
Publish your Node.js package using yarn to npm and gpr with codecoverage to codecov (Github workflow file)
name: Node.js Package
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: 'https://registry.npmjs.org'
- run: yarn install --frozen-lockfile
coverage:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
registry-url: https://registry.npmjs.org
- run: yarn install --frozen-lockfile
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
- run: yarn install --frozen-lockfile
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment