Skip to content

Commit 02afff3

Browse files
authored
Add GitHub Actions workflow for ZScript build
1 parent 5b8061b commit 02afff3

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

.github/workflows/zsc-build.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Build and Release ZScript
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build ${{ matrix.name }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
# ---------- LINUX ----------
20+
- os: ubuntu-latest
21+
name: linux-x64
22+
target: bun-linux-x64
23+
archive: tar.gz
24+
ext: ""
25+
26+
- os: ubuntu-latest
27+
name: linux-x64-musl
28+
target: bun-linux-x64-musl
29+
archive: tar.gz
30+
ext: ""
31+
32+
- os: ubuntu-latest
33+
name: linux-arm64
34+
target: bun-linux-arm64
35+
archive: tar.gz
36+
ext: ""
37+
38+
- os: ubuntu-latest
39+
name: linux-arm64-musl
40+
target: bun-linux-arm64-musl
41+
archive: tar.gz
42+
ext: ""
43+
44+
# ---------- WINDOWS ----------
45+
- os: windows-latest
46+
name: windows-x64
47+
target: bun-windows-x64
48+
archive: zip
49+
ext: ".exe"
50+
51+
# ---------- MACOS ----------
52+
- os: macos-latest
53+
name: macos-x64
54+
target: bun-darwin-x64
55+
archive: tar.gz
56+
ext: ""
57+
58+
- os: macos-latest
59+
name: macos-arm64
60+
target: bun-darwin-arm64
61+
archive: tar.gz
62+
ext: ""
63+
64+
steps:
65+
- name: Checkout repository
66+
uses: actions/checkout@v4
67+
68+
- name: Install Bun
69+
uses: oven-sh/setup-bun@v1
70+
with:
71+
bun-version: latest
72+
73+
- name: Install dependencies
74+
working-directory: compiler
75+
run: bun install
76+
77+
- name: Build zsc binary
78+
working-directory: compiler
79+
run: |
80+
mkdir -p dist
81+
bun build zsc.js \
82+
--compile \
83+
--target=${{ matrix.target }} \
84+
--outfile dist/zsc${{ matrix.ext }}
85+
86+
# -------- Linux / macOS --------
87+
- name: Package (tar.gz)
88+
if: matrix.archive == 'tar.gz'
89+
working-directory: compiler/dist
90+
run: |
91+
chmod +x zsc
92+
tar -czf zsc-${{ matrix.name }}.tar.gz zsc
93+
94+
# -------- Windows --------
95+
- name: Package (zip)
96+
if: matrix.archive == 'zip'
97+
working-directory: compiler/dist
98+
shell: pwsh
99+
run: |
100+
Compress-Archive zsc.exe zsc-${{ matrix.name }}.zip
101+
102+
- name: Upload release asset
103+
uses: softprops/action-gh-release@v1
104+
with:
105+
files: |
106+
compiler/dist/zsc-${{ matrix.name }}.*

0 commit comments

Comments
 (0)