Skip to content

Commit c0ad580

Browse files
committed
Update build
1 parent ff40cec commit c0ad580

File tree

1 file changed

+99
-78
lines changed

1 file changed

+99
-78
lines changed

.github/workflows/build.yaml

Lines changed: 99 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
2-
push:
3-
branches:
4-
- master
2+
push:
3+
branches:
4+
- master
55

66
env:
77
REGISTRY: ghcr.io
@@ -13,6 +13,44 @@ env:
1313
COMPOSE_DOCKER_CLI_BUILD: 1
1414

1515
jobs:
16+
build-web:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
# Setup Node & PNPM
23+
- name: Setup PNPM
24+
uses: pnpm/action-setup@v4
25+
with:
26+
run_install: false
27+
standalone: true
28+
package_json_file: web/package.json
29+
version: 8
30+
31+
- name: Setup Node
32+
uses: actions/setup-node@main
33+
with:
34+
node-version: 21
35+
cache: pnpm
36+
cache-dependency-path: "web"
37+
38+
- name: Install dependencies
39+
working-directory: web
40+
run: pnpm install
41+
42+
- name: Build web
43+
working-directory: web
44+
run: pnpm build
45+
46+
- name: Upload web artifacts
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: www
50+
path: web/dist
51+
retention-days: 1
52+
compression-level: 9
53+
1654
build-engine:
1755
strategy:
1856
matrix:
@@ -40,34 +78,10 @@ jobs:
4078
workspaces: engine
4179
key: ${{ matrix.platform.arch }}
4280

43-
# Setup Node & PNPM
44-
- name: Setup PNPM
45-
uses: pnpm/action-setup@v4
46-
with:
47-
run_install: false
48-
standalone: true
49-
package_json_file: web/package.json
50-
version: 8
51-
52-
- name: Setup Node
53-
uses: actions/setup-node@main
54-
with:
55-
node-version: 21
56-
cache: pnpm
57-
cache-dependency-path: 'web'
58-
5981
# Install cross
6082
- name: Install cross
6183
run: cargo install cross
6284

63-
- name: Install dependencies
64-
working-directory: web
65-
run: pnpm install
66-
67-
- name: Build web
68-
working-directory: web
69-
run: pnpm build
70-
7185
# Update version number in engine/Cargo.toml
7286
# If tag is a release use that
7387
# Otherwise use the version number in the engine/Cargo.toml and append it with -alpha
@@ -109,13 +123,14 @@ jobs:
109123
packages: write
110124
needs: # Wait for other jobs to finish
111125
- build-engine
126+
- build-web
112127
strategy:
113-
matrix:
114-
platform:
115-
- arch: x86_64-unknown-linux-musl
116-
docker: linux/amd64
117-
- arch: aarch64-unknown-linux-musl
118-
docker: linux/arm64
128+
matrix:
129+
platform:
130+
- arch: x86_64-unknown-linux-musl
131+
docker: linux/amd64
132+
- arch: aarch64-unknown-linux-musl
133+
docker: linux/arm64
119134
steps:
120135
- name: Checkout
121136
uses: actions/checkout@v4
@@ -133,6 +148,12 @@ jobs:
133148
chmod 755 ./artifacts/edgeserver
134149
ls -la ./artifacts
135150
151+
- name: Download web artifacts
152+
uses: actions/download-artifact@v4
153+
with:
154+
name: www
155+
path: artifacts
156+
136157
# Set up QEMU for multi-arch builds
137158
- name: Set up QEMU
138159
uses: docker/setup-qemu-action@v3
@@ -200,48 +221,48 @@ jobs:
200221
needs: # Wait for other jobs to finish
201222
- docker-build
202223
steps:
203-
- name: Checkout
204-
uses: actions/checkout@v4
205-
206-
# 📥 Grab our digests
207-
- name: Download digests
208-
uses: actions/download-artifact@v4
209-
with:
210-
path: /tmp/digests
211-
pattern: digests-*
212-
merge-multiple: true
213-
214-
# Log into GitHub's container registry
215-
- name: Log in to the Container registry
216-
uses: docker/login-action@v3
217-
with:
218-
registry: ${{ env.REGISTRY }}
219-
username: ${{ github.actor }}
220-
password: ${{ secrets.GITHUB_TOKEN }}
221-
222-
# Set up Docker Buildx
223-
- name: Set up Docker Buildx
224-
uses: docker/setup-buildx-action@v3
225-
226-
# Extract metadata
227-
- name: Extract metadata (tags, labels) for Docker
228-
id: meta
229-
uses: docker/metadata-action@v5
230-
with:
231-
images: ${{ env.REGISTRY }}/${{ env.ENGINE_IMAGE_NAME }}
232-
tags: |
233-
type=semver,pattern={{version}}
234-
type=semver,pattern={{major}}.{{minor}}
235-
type=semver,pattern={{major}}
236-
type=edge
237-
type=sha
238-
239-
- name: Create manifest list and push
240-
working-directory: /tmp/digests
241-
run: |
242-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
243-
$(printf '${{ env.REGISTRY }}/${{ env.ENGINE_IMAGE_NAME }}@sha256:%s ' *)
244-
245-
- name: Inspect image
246-
run: |
247-
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.ENGINE_IMAGE_NAME }}:${{ steps.meta.outputs.version }}
224+
- name: Checkout
225+
uses: actions/checkout@v4
226+
227+
# 📥 Grab our digests
228+
- name: Download digests
229+
uses: actions/download-artifact@v4
230+
with:
231+
path: /tmp/digests
232+
pattern: digests-*
233+
merge-multiple: true
234+
235+
# Log into GitHub's container registry
236+
- name: Log in to the Container registry
237+
uses: docker/login-action@v3
238+
with:
239+
registry: ${{ env.REGISTRY }}
240+
username: ${{ github.actor }}
241+
password: ${{ secrets.GITHUB_TOKEN }}
242+
243+
# Set up Docker Buildx
244+
- name: Set up Docker Buildx
245+
uses: docker/setup-buildx-action@v3
246+
247+
# Extract metadata
248+
- name: Extract metadata (tags, labels) for Docker
249+
id: meta
250+
uses: docker/metadata-action@v5
251+
with:
252+
images: ${{ env.REGISTRY }}/${{ env.ENGINE_IMAGE_NAME }}
253+
tags: |
254+
type=semver,pattern={{version}}
255+
type=semver,pattern={{major}}.{{minor}}
256+
type=semver,pattern={{major}}
257+
type=edge
258+
type=sha
259+
260+
- name: Create manifest list and push
261+
working-directory: /tmp/digests
262+
run: |
263+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
264+
$(printf '${{ env.REGISTRY }}/${{ env.ENGINE_IMAGE_NAME }}@sha256:%s ' *)
265+
266+
- name: Inspect image
267+
run: |
268+
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.ENGINE_IMAGE_NAME }}:${{ steps.meta.outputs.version }}

0 commit comments

Comments
 (0)