Skip to content

Commit 561b8b7

Browse files
committed
Build umbrelOS docker images in CI
1 parent af2aac5 commit 561b8b7

File tree

3 files changed

+1010
-22
lines changed

3 files changed

+1010
-22
lines changed

.github/workflows/create-release-on-tag.yml

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,72 @@ name: Create release on tag
33
on:
44
push:
55
tags:
6-
- "*"
7-
8-
defaults:
9-
run:
10-
working-directory: packages/os
6+
- '*'
117

128
jobs:
13-
build-os:
14-
runs-on: ${{ matrix.task == 'build:amd64' && 'ubicloud-standard-16' || 'ubicloud-standard-16-arm' }}
9+
create-release:
10+
runs-on: 64-core-amd64
11+
permissions:
12+
contents: read
13+
packages: write
1514
defaults:
1615
run:
1716
working-directory: packages/os
18-
strategy:
19-
fail-fast: false
20-
matrix:
21-
task:
22-
- build:amd64
23-
- build:arm64
2417
steps:
18+
# Checkout
2519
- uses: actions/checkout@v3
26-
- uses: docker/setup-buildx-action@v2
20+
21+
# Build Docker images
22+
- run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
23+
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.repository_owner }}" --password-stdin
24+
- run: docker buildx create --use
25+
- run: docker buildx build --platform linux/amd64,linux/arm64 --file umbrelos.Dockerfile --tag ghcr.io/${{ github.repository_owner }}/umbrelos:${{ env.VERSION }} --push ../../
26+
- run: mkdir -p build &&docker buildx imagetools inspect ghcr.io/${{ github.repository_owner }}/umbrelos:${{ env.VERSION }} > build/docker-umbrelos-${{ env.VERSION }}
27+
28+
# Build OS images
2729
- uses: actions/setup-node@v3
2830
with:
2931
node-version: 18
30-
- run: npm run ${{ matrix.task }}
32+
# Awkward hack to run in parallel but correctly handle errors
33+
- run: |
34+
npm run build:amd64 &
35+
pid1=$!
36+
npm run build:arm64 &
37+
pid2=$!
38+
wait $pid1 || exit 1
39+
wait $pid2 || exit 1
3140
3241
# TODO: Use .img.xz for all release assets once https://github.com/balena-io/etcher/issues/4064 is fixed
33-
- name: Prepare arm64 release assets
34-
if: matrix.task == 'build:arm64'
35-
run: cd build && (zip umbrelos-pi4.img.zip umbrelos-pi4.img & zip umbrelos-pi5.img.zip umbrelos-pi5.img & wait)
36-
- name: Prepare amd64 release assets
37-
if: matrix.task == 'build:amd64'
38-
run: cd build && sudo xz --keep --threads=0 umbrelos-amd64.img
42+
- name: Compress release assets
43+
# Awkward hack to run in parallel but correctly handle errors
44+
run: |
45+
cd build
46+
zip umbrelos-pi4.img.zip umbrelos-pi4.img &
47+
pid1=$!
48+
zip umbrelos-pi5.img.zip umbrelos-pi5.img &
49+
pid2=$!
50+
sudo xz --keep --threads=0 umbrelos-amd64.img &
51+
pid3=$!
52+
wait $pid1 || exit 1
53+
wait $pid2 || exit 1
54+
wait $pid3 || exit 1
3955
4056
- name: Create USB installer
41-
if: matrix.task == 'build:amd64'
4257
run: npm run build:amd64:usb-installer
4358

59+
- name: Create SHASUM
60+
run: shasum -a 256 build/* | tee build/SHA256SUMS
61+
62+
- name: OpenTimestamps
63+
run: npm ci && npx ots-cli.js stamp build/SHA256SUMS
64+
4465
- name: Create GitHub Release
4566
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
4667
with:
4768
draft: true
4869
name: umbrelOS ${{ github.ref_name }}
4970
files: |
71+
packages/os/build/SHA256SUMS*
5072
packages/os/build/*.update
5173
packages/os/build/*.img.zip
5274
packages/os/build/*.img.xz

0 commit comments

Comments
 (0)