-
Notifications
You must be signed in to change notification settings - Fork 37
56 lines (53 loc) · 2.04 KB
/
publish_npm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Publish current branch to npm
on:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
package: [., packages/dbos-cloud, packages/dbos-openapi, packages/communicator-datetime, packages/communicator-bcrypt, packages/communicator-random]
steps:
- name: Checkout
uses: actions/checkout@v4.1.0
with:
fetch-depth: 0 # fetch-depth 0 needed for NBGV
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Nerdbank.GitVersioning
id: nbgv
uses: dotnet/nbgv@v0.4.1
with:
stamp: ${{ matrix.package }}/package.json
- run: cd ${{ matrix.package }}; npm ci
- run: cd ${{ matrix.package }}; npm run build
- name: Publish release to npm
uses: JS-DevTools/npm-publish@v3
id: npmrelease
# boolean properties from NBGV step appears to be converted into *capitalized* strings
# so explicitly string compare PublicRelease output value
if: ${{ steps.nbgv.outputs.PublicRelease == 'True'}}
with:
token: ${{ secrets.NPM_PUBLISH }}
registry: https://registry.npmjs.org/
tag: ${{ steps.nbgv.outputs.PrereleaseVersion == '' && 'latest' || 'preview' }} # Assign a 'preview' tag to versions end with '-preview'. Otherwise, assign a 'latest' tag to the latest release.
access: public
package: ${{ matrix.package }}
- name: Publish test package to npm
uses: JS-DevTools/npm-publish@v3
id: npmtest
if: ${{ steps.nbgv.outputs.PublicRelease == 'False'}}
with:
token: ${{ secrets.NPM_PUBLISH }}
registry: https://registry.npmjs.org/
tag: 'test'
access: public
package: ${{ matrix.package }}
- if: ${{ steps.npmrelease.outputs.type }}
run: echo "Published a new release package!"
- if: ${{ steps.npmtest.outputs.type }}
run: echo "Published a new test package!"