-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.83 KB
/
release-js.yaml
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
57
58
59
60
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Release JS Library
run-name: Publish Release ${{github.ref_name}} JS Library
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: false
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # ex. v1.0.0
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" # ex. v1.1.0-rc1
- "v0.0.1" # used for testing only
- "v0.0.1-rc[0-9]+" # used for testing only
env:
NEW_RELEASE_TAG: ${{github.ref_name}}
TEST_RUN: ${{startsWith(github.ref_name, 'v0.0.1')}}
jobs:
publish-npm:
name: Publish NPM Package
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm i
- name: Build
run: npm run build
- name: Version Package
if: env.TEST_RUN != 'true'
working-directory: ./dist
run: npm version --new-version "${{env.NEW_RELEASE_TAG}}" --no-git-tag-version
# Required for Granular Access Tokens
- name: NPM Access Config
run: npm config set //registry.npmjs.org/:_authToken ${{secrets.NODE_AUTH_TOKEN}}
- name: Release on NPM @latest
if: env.TEST_RUN != 'true' && steps.is-full-release.outputs.is-full-release == 'true'
working-directory: ./dist
run: npm publish --tag latest --access public
- name: Release Candidate on NPM
if: env.TEST_RUN != 'true' && steps.is-full-release.outputs.is-full-release != 'true'
working-directory: ./dist
run: npm publish --access public