Skip to content

Commit 0d10f44

Browse files
authored
Create build.yml
1 parent 3d75022 commit 0d10f44

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

.github/workflows/build.yml

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

0 commit comments

Comments
 (0)