Skip to content

Commit 47477f2

Browse files
ilianadavid-crespo
andauthored
move CI build commands into reusable script (#3439)
Co-authored-by: David Crespo <[email protected]>
1 parent e78bb08 commit 47477f2

4 files changed

Lines changed: 33 additions & 14 deletions

File tree

‎.github/workflows/lintBuildTest.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ jobs:
4949
run: npm run fmt:check
5050
- name: Test
5151
run: npm test run -- --project unit
52-
- name: Build
53-
run: npm run build
52+
# Same packaging as upload-assets.yaml, minus the upload
53+
- name: Build and package
54+
run: SHA=${{ github.sha }} .github/workflows/package.sh
5455
playwright:
5556
name: Playwright (${{ matrix.playwright }})
5657
timeout-minutes: 20

‎.github/workflows/package.sh‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# This Source Code Form is subject to the terms of the Mozilla Public
3+
# License, v. 2.0. If a copy of the MPL was not distributed with this
4+
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
5+
#
6+
# Copyright Oxide Computer Company
7+
8+
set -euxo pipefail
9+
10+
npm run build
11+
# Gzip individual files (keep originals)
12+
ls build/client/assets/*.{js,css,map} | xargs gzip --keep
13+
# add console_version file
14+
echo "${SHA}" > build/client/VERSION
15+
# add API_VERSION file
16+
cp app/api/__generated__/API_VERSION build/client/API_VERSION
17+
18+
mkdir -p releases/console
19+
# Make <sha>.tar.gz
20+
tar czf releases/console/"${SHA}".tar.gz --directory=build/client .
21+
# Write sha256sum to file
22+
sha256sum releases/console/"${SHA}".tar.gz | awk '{print $1}' > releases/console/"${SHA}".sha256.txt

‎.github/workflows/upload-assets.yaml‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,12 @@ jobs:
2323
with:
2424
project_id: oxide-downloads
2525
- run: npm install
26+
27+
# Keep all packaging commands in .github/workflows/package.sh so that
28+
# source escrow tooling can re-use the same commands.
2629
- name: Build for Nexus
27-
run: SHA=${{ github.sha }} npm run build
28-
- name: Gzip individual files (keep originals)
29-
run: ls build/client/assets/*.{js,css,map} | xargs gzip --keep
30-
- name: add console_version file
31-
run: echo ${{ github.sha }} > build/client/VERSION
32-
- name: add API_VERSION file
33-
run: cp app/api/__generated__/API_VERSION build/client/API_VERSION
34-
- run: mkdir -p releases/console
35-
- name: Make <sha>.tar.gz
36-
run: tar czf releases/console/${{ github.sha }}.tar.gz --directory=build/client .
37-
- name: Write sha256sum to file
38-
run: sha256sum releases/console/${{ github.sha }}.tar.gz | awk '{print $1}' > releases/console/${{ github.sha }}.sha256.txt
30+
run: SHA=${{ github.sha }} .github/workflows/package.sh
31+
3932
- name: Upload files to GCP bucket
4033
id: upload-files
4134
uses: google-github-actions/upload-cloud-storage@v3

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ test/visual/**/*.png
4040

4141
# React Router build output. build/client is the deployable static site
4242
/build/
43+
44+
# package.sh output (.github/workflows/package.sh)
45+
/releases/

0 commit comments

Comments
 (0)