Skip to content

Commit 345e563

Browse files
committed
fix update & release - don't publish on non main branch
1 parent bab3377 commit 345e563

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ jobs:
9292
path: prebuilds/*
9393

9494
update-version-and-release:
95-
needs: build
95+
needs: [compute-shasum, build]
96+
if: ${{ needs.compute-shasum.result == 'failure' && needs.build.result == 'success' }}
9697
runs-on: ubuntu-latest
97-
9898
steps:
9999
- name: Checkout Repository
100100
uses: actions/checkout@v4
@@ -135,6 +135,7 @@ jobs:
135135
merge-multiple: true
136136

137137
- name: Create GitHub Release
138+
if: github.ref == 'refs/heads/main'
138139
uses: softprops/action-gh-release@v2
139140
with:
140141
tag_name: "v${{ env.new_version }}"
@@ -152,12 +153,14 @@ jobs:
152153
.last-shasum
153154
154155
- name: Publish to npm
156+
if: github.ref == 'refs/heads/main'
155157
uses: actions/setup-node@v4
156158
with:
157159
node-version: ${{ env.NODE_VERSION }}
158160
registry-url: "https://registry.npmjs.org/"
159161

160162
- name: Publish Package
163+
if: github.ref == 'refs/heads/main'
161164
run: npm publish
162165
env:
163166
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)