Skip to content

Commit ad1294b

Browse files
Merge pull request #24 from lightpanda-io/release
ci: build release
2 parents d34d83e + e0e49a8 commit ad1294b

File tree

1 file changed

+50
-47
lines changed

1 file changed

+50
-47
lines changed

.github/workflows/build-release.yml

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,68 @@ on:
44
push:
55
tags:
66
- "**"
7-
# Allows you to run this workflow manually from the Actions tab
8-
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
910

1011
env:
11-
REGISTRY: ghcr.io
12-
IMAGE_NAME: lightpanda-io/v8
12+
ZIG_VERSION: 0.12.1
1313

1414
jobs:
15-
# build-release compiles v8 from source using zig.
16-
# It pushes a docker image containing only /libc_v8.a file from scratch image.
17-
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action
18-
build-release:
19-
strategy:
20-
matrix:
21-
include:
22-
- arch: x86_64
23-
os: linux
24-
build_arch: amd64
25-
zig_docker_version: 0.12.1
26-
name: build-release
15+
build-x86_64-linux:
16+
env:
17+
OS: linux
18+
ARCH: x86_64
19+
2720
runs-on: ubuntu-latest
28-
permissions:
29-
contents: read
30-
packages: write
3121
steps:
22+
- uses: mlugg/setup-zig@v1
23+
with:
24+
version: ${{ env.ZIG_VERSION }}
25+
3226
- uses: actions/checkout@v4
3327
with:
3428
submodules: recursive
3529
fetch-depth: 0
3630

37-
- name: Read version
38-
id: read-version
39-
run: |
40-
echo "version=`cat V8_REVISION`" >> "$GITHUB_OUTPUT"
31+
- run: zig build get-tools
32+
- run: zig build get-v8
33+
- run: zig build -Doptimize=ReleaseSafe
34+
- run: mv v8-build/${{ env.ARCH }}-${{ env.OS }}/release/ninja/obj/zig/libc_v8.a libc_v8_${{ env.OS }}_${{ env.ARCH }}.a
35+
36+
- name: Upload the build
37+
uses: ncipollo/release-action@v1
38+
with:
39+
allowUpdates: true
40+
artifacts: libc_v8_${{ env.OS }}_${{ env.ARCH }}.a
41+
42+
build-aarch64-macos:
43+
env:
44+
OS: macos
45+
ARCH: aarch64
46+
47+
runs-on: macos-latest
48+
steps:
49+
- uses: mlugg/setup-zig@v1
50+
with:
51+
version: ${{ env.ZIG_VERSION }}
4152

42-
- name: Docker connect
43-
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
53+
- uses: actions/setup-python@v5
4454
with:
45-
registry: ${{ env.REGISTRY }}
46-
username: ${{ github.actor }}
47-
password: ${{ secrets.GITHUB_TOKEN }}
48-
- name: Extract metadata (tags, labels) for Docker
49-
id: meta
50-
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
55+
python-version: '3.11'
56+
57+
- uses: actions/checkout@v4
5158
with:
52-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
53-
- name: Docker build
54-
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
59+
submodules: recursive
60+
fetch-depth: 0
61+
62+
- run: zig build get-tools
63+
- run: zig build get-v8
64+
- run: zig build -Doptimize=ReleaseSafe
65+
- run: mv v8-build/${{ env.ARCH }}-${{ env.OS }}/release/ninja/obj/zig/libc_v8.a libc_v8_${{ env.OS }}_${{ env.ARCH }}.a
66+
67+
- name: Upload the build
68+
uses: ncipollo/release-action@v1
5569
with:
56-
context: .
57-
push: true
58-
tags: |
59-
${{ steps.meta.outputs.tags }}
60-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{steps.meta.outputs.version}}_v8-${{steps.read-version.outputs.version}}_zig-${{matrix.zig_docker_version}}
61-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{matrix.zig_docker_version}}
62-
labels: |
63-
${{ steps.meta.outputs.labels }}
64-
build-args: |
65-
ZIG_DOCKER_VERSION=${{matrix.zig_docker_version}}
66-
ARCH=${{matrix.arch}}
67-
OS=${{matrix.os}}
68-
platforms: ${{matrix.os}}/${{matrix.build_arch}}
70+
allowUpdates: true
71+
artifacts: libc_v8_${{ env.OS }}_${{ env.ARCH }}.a

0 commit comments

Comments
 (0)