Skip to content

Commit d9ed897

Browse files
committed
chore(ci/cd): add separate "npm pre-release publish" step
1 parent 7092f3f commit d9ed897

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/yarn-npm-publish.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
22
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
33

4-
name: Publish to NPM (using yarn)
4+
name: Publish to NPM
55

66
on:
77
release:
@@ -23,13 +23,25 @@ jobs:
2323
needs: build
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v3
27-
- uses: actions/setup-node@v3
26+
- name: 'Checkout tagged commit'
27+
uses: actions/checkout@v3
28+
with:
29+
ref: ${{ github.event.release.target_commitish }}
30+
- name: 'Setup Node.js'
31+
uses: actions/setup-node@v3
2832
with:
2933
node-version: 18.x
3034
registry-url: https://registry.npmjs.org/
3135
cache: yarn
32-
- run: yarn --frozen-lockfile
33-
- run: yarn publish
36+
- name: 'Install dependencies'
37+
run: yarn --frozen-lockfile
38+
- name: 'Publish dotenv-flow@next'
39+
if: steps.release.outputs.tag != ''
40+
run: yarn publish --tag=next
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}
43+
- name: 'Publish dotenv-flow@latest'
44+
if: steps.release.outputs.tag == ''
45+
run: yarn publish
3446
env:
3547
NODE_AUTH_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}

0 commit comments

Comments
 (0)