Skip to content

Commit 3af2afb

Browse files
authored
Merge pull request #86 from UW-Macrostrat/build-website-workflow
Build website workflow
2 parents e09d2df + 9e805f9 commit 3af2afb

File tree

4 files changed

+74
-14
lines changed

4 files changed

+74
-14
lines changed

.github/workflows/build.yaml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,46 @@ on:
1818

1919
jobs:
2020
test:
21-
name: Static Website Build
21+
name: Static website build
2222
runs-on: ubuntu-latest
23+
environment: production
2324
steps:
2425

2526
- name: Check out repository
2627
uses: actions/checkout@v4
2728

28-
- name: Setup Node
29+
- name: Setup node
2930
uses: actions/setup-node@v4
31+
with:
32+
node-version: 18
33+
34+
- name: Pin react-docgen version
35+
run: yarn add -D [email protected]
3036

31-
- name: Build the static website
37+
- name: Install dependencies
3238
run: |
3339
yarn install
34-
yarn run build
35-
36-
- name: Upload artifact
37-
uses: actions/upload-pages-artifact@v3
38-
with:
39-
# Upload entire repository
40-
path: './storybook/storybook-static'
4140
42-
- name: Deploy to GitHub Pages
43-
id: deployment
44-
uses: actions/deploy-pages@v4
41+
- name: Build storybook
42+
run: |
43+
yarn run build:storybook
44+
45+
- name: Install rclone
46+
run: |
47+
curl https://rclone.org/install.sh | sudo bash
48+
49+
- name: Upload to S3
50+
env:
51+
S3_BUCKET: ${{ vars.S3_BUCKET }}
52+
S3_PATH: ${{ vars.S3_PATH }}
53+
S3_ENDPOINT: ${{ vars.S3_ENDPOINT }}
54+
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
55+
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
56+
run: |
57+
echo "Uploading to S3 bucket: $S3_BUCKET"
58+
rclone sync ./storybook-static \
59+
:s3:"$S3_BUCKET/$S3_PATH" \
60+
--s3-provider=Ceph \
61+
--s3-endpoint="$S3_ENDPOINT" \
62+
--s3-access-key-id="$S3_ACCESS_KEY" \
63+
--s3-secret-access-key="$S3_SECRET_KEY"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"@parcel/packager-ts": "^2.14.4",
7777
"@types/d3-array": "^3.2.1",
7878
"@types/underscore": "^1.13.0",
79-
"madge": "^8.0.0"
79+
"madge": "^8.0.0",
80+
"react-docgen": "7.0.0"
8081
}
8182
}

scripts/publish-s3.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Upload the built storybook to S3
2+
# load environment variables from .env file
3+
export $(grep -v '^#' .env | xargs)
4+
5+
# Use Rclone to sync the built storybook to S3, without RClone config
6+
7+
echo "Uploading to S3 bucket: $S3_BUCKET"
8+
9+
rclone sync ./storybook-static \
10+
:s3:"$S3_BUCKET/$S3_PATH" \
11+
--s3-provider=Ceph \
12+
--s3-endpoint="$S3_ENDPOINT" \
13+
--s3-access-key-id="$S3_ACCESS_KEY" \
14+
--s3-secret-access-key="$S3_SECRET_KEY"

yarn.lock

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,6 +2644,7 @@ __metadata:
26442644
parcel: "npm:^2.14.4"
26452645
prettier: "npm:^2.7.1"
26462646
react: "npm:^18"
2647+
react-docgen: "npm:7.0.0"
26472648
react-dom: "npm:^18"
26482649
sass-embedded: "npm:^1.83.0"
26492650
storybook: "npm:^8.6.8"
@@ -5311,6 +5312,13 @@ __metadata:
53115312
languageName: node
53125313
linkType: hard
53135314

5315+
"@types/doctrine@npm:^0.0.8":
5316+
version: 0.0.8
5317+
resolution: "@types/doctrine@npm:0.0.8"
5318+
checksum: 10c0/ca4cab4a94526ec3579c3f10a027298028d34b4c092e4b6791afb37a5f6899208ee1e91bc9542541f31d6d3ba3d1a70408deaa1f105c22c86d23e3a87c59a43c
5319+
languageName: node
5320+
linkType: hard
5321+
53145322
"@types/doctrine@npm:^0.0.9":
53155323
version: 0.0.9
53165324
resolution: "@types/doctrine@npm:0.0.9"
@@ -10783,6 +10791,24 @@ __metadata:
1078310791
languageName: node
1078410792
linkType: hard
1078510793

10794+
"react-docgen@npm:7.0.0":
10795+
version: 7.0.0
10796+
resolution: "react-docgen@npm:7.0.0"
10797+
dependencies:
10798+
"@babel/core": "npm:^7.18.9"
10799+
"@babel/traverse": "npm:^7.18.9"
10800+
"@babel/types": "npm:^7.18.9"
10801+
"@types/babel__core": "npm:^7.18.0"
10802+
"@types/babel__traverse": "npm:^7.18.0"
10803+
"@types/doctrine": "npm:^0.0.8"
10804+
"@types/resolve": "npm:^1.20.2"
10805+
doctrine: "npm:^3.0.0"
10806+
resolve: "npm:^1.22.1"
10807+
strip-indent: "npm:^4.0.0"
10808+
checksum: 10c0/79678d01644e6519450f847c77fa554a7a80ae3a5ff81b1482d1458caa064cf3be88597051375ba7a90921980feb8586378e1560146d64c41d0e569465315575
10809+
languageName: node
10810+
linkType: hard
10811+
1078610812
"react-docgen@npm:^7.0.0":
1078710813
version: 7.1.1
1078810814
resolution: "react-docgen@npm:7.1.1"

0 commit comments

Comments
 (0)