Skip to content

Commit

Permalink
fix(ci): update workflows (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
dankreiger committed Nov 26, 2022
1 parent 1be1f4e commit 78aa62a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish to NPM Registry
name: Main
on:
release:
types: [created]
push:
branches: [main]
jobs:
publish:
name: 'On Main Push - Release version to NPM Registry'
Expand Down Expand Up @@ -47,4 +47,4 @@ jobs:
mv package.jsone package.json
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
50 changes: 50 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish to NPM Registry
on:
release:
types: [created]
jobs:
publish:
name: 'On Main Push - Release version to NPM Registry'
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup configuration for NPM registry
uses: actions/setup-node@v3
with:
node-version: '16.15.0'
registry-url: 'https://registry.npmjs.org'
scope: '@dankreiger'

- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1

- name: Lint
run: npm run lint

- name: Test
run: npm run test --ci --coverage --maxWorkers=2

- name: Build
run: npm run build

- name: Create release and publish scoped package
run: HUSKY=0 npm run release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish unscoped package
run: |
sed -ie 's/@dankreiger\///g' package.json
npm publish
mv package.jsone package.json
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 78aa62a

Please sign in to comment.