generated from nl-design-system/example
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (77 loc) · 2.78 KB
/
continuous-deployment.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Continuous Deployment
on:
push:
branches:
- main
pull_request:
jobs:
continuous-integration:
name: Continuous integration
runs-on: ubuntu-latest
steps:
- name: Download code from GitHub
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Install pnpm package manager
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- name: Set up Node.js version
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies specified in package.json
run: |
pnpm install --frozen-lockfile
pnpm ls --recursive
- name: Run the lint script in package.json scripts
run: |
pnpm run --if-present lint
- name: Run the build script in package.json scripts
env:
GH_ISSUES_TOKEN: ${{ secrets.GH_ISSUES_TOKEN }}
run: |
pnpm run --if-present build
- name: Run the test script in package.json scripts
run: |
pnpm run --if-present test
publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
needs: continuous-integration
if: github.ref == 'refs/heads/main'
steps:
- name: Download code from GitHub
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
token: ${{ secrets.GH_TOKEN }}
- name: Install pnpm package manager
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
- name: Set up Node.js version
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies as specified in package.json
run: |
pnpm install --frozen-lockfile
pnpm ls --recursive
- name: Run the build script in package.json scripts
env:
GH_ISSUES_TOKEN: ${{ secrets.GH_ISSUES_TOKEN }}
run: pnpm run --if-present build
- name: Publish to GitHub repository
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: "NL Design System"
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
GIT_COMMITTER_NAME: "NL Design System"
run: |
git push --set-upstream origin HEAD
pnpm run release
- name: Publish to npm repository
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pnpm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"
pnpm run publish
pnpm config delete "//registry.npmjs.org/:_authToken"