-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (61 loc) · 1.86 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 nopalm to npm registry
on:
push:
branches:
- main
jobs:
versioning:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'
# Install all dependencies (including devDependencies for lint/test/build)
- name: Install dependencies
run: yarn install
# Run linting
- name: Run lint
run: yarn lint
# Run tests
- name: Run tests
run: yarn test
# Build production version of react client
- name: Build client
run: yarn build-client
# Verify NPM_TOKEN
- name: Verify NPM_TOKEN
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "NPM_TOKEN: $NPM_TOKEN"
echo "secrets.NPM_TOKEN: ${{ secrets.NPM_TOKEN }}"
curl -H "Authorization: Bearer ${{ secrets.NPM_TOKEN }}" https://registry.npmjs.org/-/whoami
# Semantic release step: Automatically determine the version and release
- name: Semantic Release for versioning
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn release
publish:
needs: versioning
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install production dependencies
run: yarn install --frozen-lockfile --production
# Publish to npm
- name: Publish to npm
run: yarn publish --non-interactive
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}