-
Notifications
You must be signed in to change notification settings - Fork 27
193 lines (172 loc) · 5.62 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
186
187
188
189
190
191
192
193
# 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: ubuntu:latest
# The steps for the setup job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout Codebase
uses: actions/checkout@v4
# @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
# # @see https://github.com/marketplace/actions/cache
# # node_modules caching is validated by always running yarn install.
# # Turborepo cache lives inside node_modules/.cache/turbo
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
# - name: Setup Cache
# id: cache-yarn
# uses: actions/cache@v3
# env:
# cache-name: cache-node-modules
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-node-yarn-18-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
# restore-keys:
# ${{ runner.os }}-node-yarn-18-${{ env.cache-name }}-
# ${{ runner.os }}-node-yarn-${{ env.cache-name }}-
# ${{ runner.os }}-node-yarn-
- name: Install
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: ubuntu:latest
needs: ['setup']
# The steps for the setup job.
steps:
# @see https://github.com/marketplace/actions/checkout
- name: Checkout Codebase
uses: actions/checkout@v4
# @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
run: yarn install
- name: Build Turborepo Packages
run: yarn build
- 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: ubuntu:latest
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
# @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
run: yarn install
- name: Build Outline
run: yarn build
- name: Build Storybook
run: yarn storybook:build
- name: Check GitHub Pages status
uses: crazy-max/ghaction-github-status@v3
with:
pages_threshold: major_outage
- name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v3
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