-
Notifications
You must be signed in to change notification settings - Fork 27
185 lines (163 loc) · 5.25 KB
/
build.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# Build Workflows for Outline.js
name: Outline Core Build
# Controls when the action will run. Triggers the workflow on push or pull request
on:
# Which branches to test on push/merge.
push:
branches:
- release
- main
- next
- dev
- alpha
- beta
- rc
# Which branches to test on pull request.
pull_request:
branches:
- release
- main
- next
- dev
- alpha
- beta
- rc
- /^issue/
- /^task/
- /^feature/
- /^bug/
- /^test/
# The jobs for the build workflow.
jobs:
# Basic setup job to prepare codebase.
setup:
name: Install & Lint Codebase
runs-on: ubuntu-latest
container:
image: node:lts
# The steps for the setup job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout Codebase
uses: actions/checkout@v4
- name: Use local Yarn version
run: echo "$(pwd)/.yarn/releases" >> $GITHUB_PATH
# @see https://github.com/marketplace/actions/setup-node-js-environment
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache-dependency-path: |
**/yarn.lock
**/node_modules
**/dist
**/.turbo
# The registry to use by default for package publishing.
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@phase2'
- name: Initialize .npmrc
run: cp $NPM_CONFIG_USERCONFIG .npmrc
- name: Install Dependencies
run: yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_PACKAGES }}
- name: Run eslint
run: yarn lint:eslint
- name: Run prettier
run: yarn lint:prettier
# Job to run build, and basic assurances the codebase is ready for additional processing.
build_outline:
name: Build Outline Codebase
runs-on: ubuntu-latest
container:
image: node:lts
needs: ['setup']
# The steps for the setup job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout Codebase
uses: actions/checkout@v4
- name: Use local Yarn version
run: echo "$(pwd)/.yarn/releases" >> $GITHUB_PATH
# @see https://github.com/marketplace/actions/setup-node-js-environment
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache-dependency-path: |
**/yarn.lock
**/node_modules
**/dist
**/.turbo
# The registry to use by default for package publishing.
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@phase2'
- name: Install Dependencies
run: yarn install
- name: Build Packages
run: yarn build --force
- name: Build Storybook
run: yarn storybook:build
# Basic setup job to prepare codebase.
deploy-github-pages:
name: "Publish: GitHub Pages"
if: github.ref == 'refs/heads/next'
runs-on: ubuntu-latest
container:
image: node:lts
needs: ['setup', 'build_outline']
# The steps for the setup job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v4
- name: Use local Yarn version
run: echo "$(pwd)/.yarn/releases" >> $GITHUB_PATH
# @see https://github.com/marketplace/actions/setup-node-js-environment
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache-dependency-path: |
**/yarn.lock
**/node_modules
**/dist
**/.turbo
# The registry to use by default for package publishing.
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@phase2'
- name: Install Dependencies
run: yarn install
- name: Build Packages
run: yarn build
- name: Build Storybook
run: yarn storybook:build
# @see https://github.com/marketplace/actions/github-status
- name: Check GitHub Pages status
uses: crazy-max/ghaction-github-status@v4
with:
overall_threshold: minor
pages_threshold: partial_outage
# @see https://github.com/marketplace/actions/github-pages
- name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: gh-pages
build_dir: storybook-static
commit_message: 'chore(deploy): Storybook'
keep_history: false
jekyll: false
fqdn: outline.phase2tech.com
env:
GITHUB_TOKEN: ${{ secrets.NPM_GITHUB_PACKAGES }}
# @see https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload Storybook artifact
uses: actions/upload-artifact@v4
with:
name: storybook-latest
path: storybook-static/
retention-days: 1