Skip to content

Commit 3f48a07

Browse files
committed
add build automations
1 parent f132c01 commit 3f48a07

File tree

7 files changed

+102
-13
lines changed

7 files changed

+102
-13
lines changed

.github/workflows/build.yml

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
1-
name: Build
1+
name: Release
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_run:
5+
workflows: ['Check']
6+
branches: [main]
7+
types:
8+
- completed
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
413

514
jobs:
6-
build:
15+
release-please:
716
runs-on: ubuntu-latest
17+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
18+
timeout-minutes: 1
19+
outputs:
20+
release_created: ${{ steps.release.outputs.release_created }}
21+
tag_name: ${{ steps.release.outputs.tag_name }}
22+
23+
steps:
24+
- id: release
25+
uses: googleapis/release-please-action@v4
26+
with:
27+
release-type: simple
28+
29+
upload-artifact:
30+
runs-on: ubuntu-latest
31+
needs: release-please
32+
if: ${{ needs.release-please.outputs.release_created }}
33+
timeout-minutes: 5
834

935
strategy:
1036
matrix:
11-
node-version: [18.x]
37+
node-version: [20.x]
1238

1339
steps:
1440
- uses: actions/checkout@v4
@@ -22,8 +48,44 @@ jobs:
2248
corepack enable
2349
yarn
2450
25-
- name: lint
26-
run: yarn lint
51+
- name: Build `lambda` function
52+
run: |
53+
yarn build
54+
echo '{"type": "module"}' > dist/package.json
55+
zip -rj lambda.zip dist
56+
57+
- name: Build `chromium` layer
58+
run: |
59+
mkdir work-chromium
60+
cd work-chromium
61+
git clone --depth=1 https://github.com/sparticuz/chromium.git
62+
cd chromium
63+
make chromium.zip
64+
mv chromium.zip ../../
65+
66+
- name: Build `libs` layer
67+
run: |
68+
mkdir nodejs
69+
rm -rf node_modules
70+
yarn workspaces focus --production
71+
cp -r node_modules nodejs
72+
zip -r libs.zip nodejs
73+
74+
- name: Build `fonts` layer
75+
run: |
76+
mkdir work-fonts
77+
cd work-fonts
78+
git clone --depth=1 git@github.com:dev-protocol/stackroom.git
79+
cd stackroom/fonts
80+
mv IBM_Plex_Sans_JP/* ./
81+
rm -rf IBM_Plex_Sans_JP
82+
mv Noto_Color_Emoji/* ./
83+
rm -rf Noto_Color_Emoji
84+
cd ../
85+
zip -r fonts.zip fonts
86+
mv fonts.zip ../../
2787
28-
- name: test
29-
run: yarn test
88+
- name: Upload Artifact
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
run: gh release upload ${{ needs.release-please.outputs.tag_name }} lambda.zip chromium.zip libs.zip fonts.zip

.github/workflows/check.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Check
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
check:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
node-version: [20.x]
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Use Node.js ${{ matrix.node-version }}
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: ${{ matrix.node-version }}
19+
20+
- name: install deps
21+
run: |
22+
corepack enable
23+
yarn
24+
25+
- name: lint
26+
run: yarn lint

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,5 @@ package-lock.json
109109
# astro
110110
**/.astro
111111

112-
# amplify
113-
.amplify-hosting
112+
# builds
113+
*.zip

chromium/chromium

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit cc370be2db243cb9ee84a6d85e30b6b2b7144282

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
"description": "Template repository for using TypeScript",
55
"type": "module",
66
"scripts": {
7-
"test": "vitest",
8-
"build": "astro build",
9-
"dev": "astro dev",
7+
"build": "yarn prebuild && rollup -c",
108
"prebuild": "rimraf dist",
119
"lint": "yarn lint:eslint && yarn lint:format",
1210
"lint:eslint": "eslint . --fix",

work-chromium/chromium

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit cc370be2db243cb9ee84a6d85e30b6b2b7144282

work-fonts/stackroom

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 0113787b6cba4ce469cca9553f9f39fea8ac7e0d

0 commit comments

Comments
 (0)