-
Notifications
You must be signed in to change notification settings - Fork 57
74 lines (59 loc) · 2.09 KB
/
publish.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Publish NPM Package
# Workflow to automat publishing to NPM,
# - Uses the NPM_TOKEN GitHub secret
# - Triggers when a new 'release' is created
# - Executes a publish dry-run to list out files
# - Publishes after manual approval from admin added to 'release' environment
# - Builds/published with Node 16 LTS
#
# For more details, refer to https://github.com/amazon-connect/amazon-connect-chatjs/pull/165
# Or refer to https://github.com/amazon-connect/amazon-connect-chatjs/blob/master/.github/docs/NpmPublishDocumentation.md
on:
workflow_dispatch:
release:
types: [created]
env:
RELEASE_NODE_VERSION: "16.x" # https://nodejs.dev/en/about/releases
jobs:
publish-dry-run:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.RELEASE_NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run release
- name: Set NPM_TOKEN
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
# Docs: https://docs.npmjs.com/cli/v8/commands/npm-whoami
- run: npm whoami
id: whoami
- run: npm publish --dry-run
- run: git status
build-and-publish:
needs: [publish-dry-run]
runs-on: ubuntu-latest
environment:
name: release
url: https://www.npmjs.com/package/amazon-connect-chatjs
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.RELEASE_NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
- run: npm install
- run: npm run release
- name: Create .npmrc
run: |
touch .npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "always-auth=true" >> .npmrc
- name: Publish NPM Package
run: npm publish --access public --userconfig .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}