1- # This is a basic workflow to help you get started with Actions
2-
1+ # Build Workflows for Outline.js
32name : Outline Core Build
4-
5- # Controls when the workflow will run
3+ # Controls when the action will run. Triggers the workflow on push or pull request
64on :
75 # Which branches to test on push/merge.
86 push :
@@ -38,17 +36,21 @@ jobs:
3836 runs-on : ubuntu-latest
3937 strategy :
4038 matrix :
39+ # The node versions to test against.
4140 node : [ 16, 18 ]
4241 # The steps for the setup job.
4342 steps :
4443 # @see https://github.com/marketplace/actions/checkout
4544 - name : Checkout Codebase
4645 uses : actions/checkout@v3
4746
47+ # @see https://github.com/marketplace/actions/setup-node-js-environment
4848 - uses : actions/setup-node@v3
4949 with :
50+ # The node version to use.
5051 node-version : ${{ matrix.node }}
5152 cache : ' yarn'
53+ # The registry to use by default for package publishing.
5254 registry-url : ' https://npm.pkg.github.com'
5355 # Defaults to the user or organization that owns the workflow file
5456 scope : ' @phase2'
7476 env :
7577 NODE_AUTH_TOKEN : ${{ secrets.NPM_GITHUB_PACKAGES }}
7678
77- - name : Build Outline
78- run : yarn build --force
79-
80- - name : Build Storybook
81- run : yarn storybook:build
82-
8379 # Job to run build, and basic assurances the codebase is ready for additional processing.
84- build :
85- name : Build Codebase
80+ build_outline :
81+ name : Build Outline Codebase
8682 runs-on : ubuntu-latest
8783 needs : ['setup']
8884 strategy :
@@ -121,6 +117,54 @@ jobs:
121117 - name : Build Storybook
122118 run : yarn storybook:build
123119
120+ # Test initialization of a new project
121+ build_project :
122+ name : Initialize and Test Build of Project Codebase
123+ runs-on : ubuntu-latest
124+ needs : ['build_outline']
125+ strategy :
126+ matrix :
127+ node : [ 16, 18 ]
128+ # The steps for the setup job.
129+ steps :
130+ # @see https://github.com/marketplace/actions/checkout
131+ - name : Checkout Codebase
132+ uses : actions/checkout@v3
133+
134+ - uses : actions/setup-node@v3
135+ with :
136+ node-version : ${{ matrix.node }}
137+ cache : ' yarn'
138+
139+ # @see https://github.com/marketplace/actions/cache
140+ # node_modules caching is validated by always running yarn install.
141+ # Turborepo cache lives inside node_modules/.cache/turbo
142+ - uses : actions/cache@v3
143+ id : yarn-cache
144+ with :
145+ path : |
146+ node_modules
147+ storybook-static
148+ key : ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
149+ restore-keys : |
150+ ${{ runner.os }}-node-${{ matrix.node }}-yarn-
151+
152+ - name : Install
153+ run : yarn install --prefer-offline
154+
155+ - name : Build from cache
156+ run : yarn build
157+
158+ - name : Generate a project
159+ run : |
160+ PROJDIR=$(mktemp -d)
161+ cd $PROJDIR
162+ npx ${{ github.workspace }}/packages/outline-cli init -a -l -s prj
163+ cd prj
164+ yarn install --prefer-offline
165+ yarn build
166+ yarn storybook:build
167+
124168 # Job to run package publishing process.
125169 test :
126170 name : Test Codebase
@@ -173,13 +217,13 @@ jobs:
173217 name : " Publish: GitHub Pages"
174218 if : github.ref == 'refs/heads/next'
175219 runs-on : ubuntu-latest
176- needs : ['setup', 'build ', 'test']
220+ needs : ['setup', 'build_outline ', 'test']
177221
178222 # The steps for the setup job.
179223 steps :
180224 # @see https://github.com/marketplace/actions/checkout
181225 - name : Checkout codebase
182- uses : actions/checkout@v2
226+ uses : actions/checkout@v3
183227
184228 - uses : actions/setup-node@v3
185229 with :
@@ -195,9 +239,9 @@ jobs:
195239 path : |
196240 node_modules
197241 storybook-static
198- key : ${{ runner.os }}-node-16 -yarn-${{ hashFiles('**/yarn.lock') }}
242+ key : ${{ runner.os }}-node-${{ matrix.node }} -yarn-${{ hashFiles('**/yarn.lock') }}
199243 restore-keys : |
200- ${{ runner.os }}-node-16 -yarn-
244+ ${{ runner.os }}-node-${{ matrix.node }} -yarn-
201245
202246 - name : Install
203247 run : yarn install --prefer-offline
@@ -215,18 +259,20 @@ jobs:
215259
216260 - name : Deploy to GitHub Pages
217261 if : success()
218- uses : crazy-max/ghaction-github-pages@v2
262+ uses : crazy-max/ghaction-github-pages@v3
219263 with :
220264 target_branch : gh-pages
221265 build_dir : storybook-static
222266 commit_message : ' chore(deploy): Storybook'
223- keep_history : true
267+ keep_history : false
268+ jekyll : false
269+ fqdn : outline.phase2tech.com
224270 env :
225271 GITHUB_TOKEN : ${{ secrets.NPM_GITHUB_PACKAGES }}
226272
227273 # @see https://github.com/marketplace/actions/upload-a-build-artifact
228274 - name : Upload Storybook artifact
229- uses : actions/upload-artifact@v2
275+ uses : actions/upload-artifact@v3
230276 with :
231277 name : storybook-latest
232278 path : storybook-static/
@@ -238,7 +284,7 @@ jobs:
238284 name : " Publish: GitHub Packages"
239285 runs-on : ubuntu-latest
240286 if : github.ref == 'refs/heads/release'
241- needs : ['setup', 'build ', 'test']
287+ needs : ['setup', 'build_outline ', 'test']
242288
243289 # The steps for the build job.
244290 steps :
@@ -263,9 +309,9 @@ jobs:
263309 path : |
264310 node_modules
265311 storybook-static
266- key : ${{ runner.os }}-node-16 -yarn-${{ hashFiles('**/yarn.lock') }}
312+ key : ${{ runner.os }}-node-${{ matrix.node }} -yarn-${{ hashFiles('**/yarn.lock') }}
267313 restore-keys : |
268- ${{ runner.os }}-node-16 -yarn-
314+ ${{ runner.os }}-node-${{ matrix.node }} -yarn-
269315
270316 - name : Install
271317 run : yarn install --prefer-offline
@@ -283,14 +329,14 @@ jobs:
283329 if : steps.changesets.outputs.hasChangesets == 'false'
284330 # You can do something when a publish should happen.
285331 run : yarn changeset publish
286-
332+
287333 # Job to run package publishing process.
288334 # This should ONLY be ran on on branches where
289335 deploy-npm-packages :
290336 name : " Publish: NPM Packages"
291337 runs-on : ubuntu-latest
292- if : github.ref == 'refs/heads/next '
293- needs : ['setup', 'build ', 'test']
338+ if : github.ref == 'refs/heads/release '
339+ needs : ['setup', 'build_outline ', 'test']
294340
295341 # The steps for the build job.
296342 steps :
@@ -315,9 +361,9 @@ jobs:
315361 path : |
316362 node_modules
317363 storybook-static
318- key : ${{ runner.os }}-node-16 -yarn-${{ hashFiles('**/yarn.lock') }}
364+ key : ${{ runner.os }}-node-${{ matrix.node }} -yarn-${{ hashFiles('**/yarn.lock') }}
319365 restore-keys : |
320- ${{ runner.os }}-node-16 -yarn-
366+ ${{ runner.os }}-node-${{ matrix.node }} -yarn-
321367
322368 - name : Install
323369 run : yarn install --prefer-offline
@@ -339,12 +385,12 @@ jobs:
339385 chromatic-deployment :
340386 name : " Publish: Chromatic"
341387 runs-on : ubuntu-latest
342- needs : ['setup', 'build ', 'test']
388+ needs : ['setup', 'build_outline ', 'test']
343389
344390 steps :
345391 # @see https://github.com/marketplace/actions/checkout
346392 - name : Checkout codebase
347- uses : actions/checkout@v2
393+ uses : actions/checkout@v3
348394 with :
349395 fetch-depth : 0 # 👈 Required to retrieve git history
350396
@@ -362,9 +408,9 @@ jobs:
362408 path : |
363409 node_modules
364410 storybook-static
365- key : ${{ runner.os }}-node-16 -yarn-${{ hashFiles('**/yarn.lock') }}
411+ key : ${{ runner.os }}-node-${{ matrix.node }} -yarn-${{ hashFiles('**/yarn.lock') }}
366412 restore-keys : |
367- ${{ runner.os }}-node-16 -yarn-
413+ ${{ runner.os }}-node-${{ matrix.node }} -yarn-
368414
369415 - name : Install
370416 run : yarn install --prefer-offline
0 commit comments