Skip to content

Commit

Permalink
Merge pull request #62 from nitrictech/refactor/fix-release-workflow
Browse files Browse the repository at this point in the history
chore: add nitric bot token to fix publish flow
  • Loading branch information
tjholm authored Sep 30, 2021
2 parents 33abe68 + c0dd358 commit 1ab3e75
Showing 1 changed file with 40 additions and 38 deletions.
78 changes: 40 additions & 38 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
name: Publish to NPM on Github Release

on:
on:
release:
types: [published]
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache Dependencies
uses: actions/cache@v2
with:
path: 'node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}

- name: Use Node 14
uses: actions/setup-node@v1
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
always-auth: true

- name: Set Version
run: npm version ${{ github.event.release.tag_name }}

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Publish latest to NPM
if: "!github.event.release.prerelease"
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish latest RC to NPM
if: "github.event.release.prerelease"
run: npm publish --access public --tag rc-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.NITRIC_BOT_TOKEN }}

- name: Cache Dependencies
uses: actions/cache@v2
with:
path: 'node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}

- name: Use Node 14
uses: actions/setup-node@v1
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
always-auth: true

- name: Set Version
run: npm version ${{ github.event.release.tag_name }}

- name: Install Dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Publish latest to NPM
if: '!github.event.release.prerelease'
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish latest RC to NPM
if: 'github.event.release.prerelease'
run: npm publish --access public --tag rc-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 1ab3e75

Please sign in to comment.