|
4 | 4 | push: |
5 | 5 | tags: |
6 | 6 | - "**" |
7 | | - # Allows you to run this workflow manually from the Actions tab |
8 | | - workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
9 | 10 |
|
10 | 11 | env: |
11 | | - REGISTRY: ghcr.io |
12 | | - IMAGE_NAME: lightpanda-io/v8 |
| 12 | + ZIG_VERSION: 0.12.1 |
13 | 13 |
|
14 | 14 | 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 | + |
27 | 20 | runs-on: ubuntu-latest |
28 | | - permissions: |
29 | | - contents: read |
30 | | - packages: write |
31 | 21 | steps: |
| 22 | + - uses: mlugg/setup-zig@v1 |
| 23 | + with: |
| 24 | + version: ${{ env.ZIG_VERSION }} |
| 25 | + |
32 | 26 | - uses: actions/checkout@v4 |
33 | 27 | with: |
34 | 28 | submodules: recursive |
35 | 29 | fetch-depth: 0 |
36 | 30 |
|
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 }} |
41 | 52 |
|
42 | | - - name: Docker connect |
43 | | - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
| 53 | + - uses: actions/setup-python@v5 |
44 | 54 | 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 |
51 | 58 | 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 |
55 | 69 | 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