-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (55 loc) · 1.62 KB
/
npm.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
61
62
63
name: NPM Package
on:
push:
branches-ignore:
- "**"
tags:
- v*
workflow_dispatch:
inputs:
version:
description: "Package version"
required: true
tag:
description: "Package tag"
required: true
default: "latest"
type: choice
options:
- latest
- beta
jobs:
npm-upload:
name: NPM Package Build and Upload
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: "npm"
- run: npm ci
- id: semver
run: |
SEMVER="${{ github.event.inputs.version }}"
if [ -z "$SEMVER" ]; then
# No manual input, we must be running on a tag
SEMVER="${GITHUB_REF/refs\/tags\/v/}"
fi
echo "semver=${SEMVER}" >> $GITHUB_OUTPUT
- run: scripts/make-npm-package.sh "${{ steps.semver.outputs.semver }}" ./build/npm-package
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTOMATION_TOKEN }}" > ./build/npm-package/.npmrc
- run: |
RELEASE_TAG="${{ github.event.inputs.tag }}"
if [ -z "$RELEASE_TAG" ]; then
if grep -q -- '-beta' <<< "${{ steps.semver.outputs.semver }}"; then
RELEASE_TAG=beta
else
# No manual input, we must be running on a tag
RELEASE_TAG=latest
fi
fi
npm publish --tag "$RELEASE_TAG" --access public
working-directory: ./build/npm-package