Skip to content

Commit

Permalink
publish to GPR & NPM
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus authored Feb 1, 2023
1 parent 441bc69 commit 8b336f1
Showing 1 changed file with 50 additions and 6 deletions.
56 changes: 50 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,68 @@
name: Publish

on:
release:
types: [created]

jobs:
publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout the project
uses: actions/checkout@v3
- name: Use Node.js 16.x (LTS)
uses: actions/setup-node@v3
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18
registry-url: https://registry.npmjs.org/
cache: npm
- run: npm ci
- run: npm test
- run: npm version ${TAG_NAME} --git-tag-version=false
env:
TAG_NAME: ${{ github.event.release.tag_name }}
- run: npm whoami; npm publish --access public

# Provenance beta builds
# Remove when stable
- name: Clone npm
uses: actions/checkout@v3
with:
repository: npm/cli
ref: provenance
path: npm
- name: Link npm
run: |
cd npm
node . link
cd ..
npm version
# Provenance beta builds
# Remove when stable

- run: npm whoami; npm --ignore-scripts publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
publish-github:
name: Publish to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com
cache: npm
scope: '@github'
- run: npm ci
- run: npm test
- run: npm version ${TAG_NAME} --git-tag-version=false
env:
TAG_NAME: ${{ github.event.release.tag_name }}
- run: npm --ignore-scripts publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8b336f1

Please sign in to comment.