Skip to content

Commit

Permalink
update npm publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoisaiah committed Nov 25, 2023
1 parent db2344d commit b041877
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Upload assets to latest release
if: github.event_name == 'repository_dispatch'
run: |
if [ ${{ github.event.client_payload.ref }} == 'master' ]; then
if [ ${{ github.event.client_payload.ref_type }} == 'branch' ]; then
gh release upload ${{ env.dev_tag }} dist/*.tar.gz dist/darwin-checksums.txt --clobber
else
gh release upload ${{ github.event.client_payload.ref }} dist/*.tar.gz dist/darwin-checksums.txt --clobber
Expand All @@ -67,3 +67,9 @@ jobs:
echo "${{ github.event.client_payload.ref }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Trigger NPM Publish
uses: peter-evans/repository-dispatch@v2
if: github.event.client_payload.ref_type == 'tag'
with:
event-type: release-focus-npm
14 changes: 6 additions & 8 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
name: Publish to NPM

on:
workflow_dispatch:
push:
tags:
- 'v*'
repository_dispatch:
types: [release-focus-npm]

jobs:
build:
publish_npm:
name: Publish new Focus version
runs-on: ubuntu-latest

steps:
- name: Check out the code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: '20'

- name: Publish
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ jobs:
uses: peter-evans/repository-dispatch@v2
with:
event-type: release-focus
client-payload: '{"ref": "${{ github.ref_name }}" }'
client-payload: '{"ref": "${{ github.ref_name }}", "ref_type": "${{ github.ref_type }}" }'

0 comments on commit b041877

Please sign in to comment.