Skip to content

Create build.yml

Create build.yml #1

Workflow file for this run

name: Build and Release ZScript
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# ---------- LINUX ----------
- os: ubuntu-latest
name: linux-x64
target: bun-linux-x64
archive: tar.gz
ext: ""
- os: ubuntu-latest
name: linux-x64-musl
target: bun-linux-x64-musl
archive: tar.gz
ext: ""
- os: ubuntu-latest
name: linux-arm64
target: bun-linux-arm64
archive: tar.gz
ext: ""
- os: ubuntu-latest
name: linux-arm64-musl
target: bun-linux-arm64-musl
archive: tar.gz
ext: ""
# ---------- WINDOWS ----------
- os: windows-latest
name: windows-x64
target: bun-windows-x64
archive: zip
ext: ".exe"
# ---------- MACOS ----------
- os: macos-latest
name: macos-x64
target: bun-darwin-x64
archive: tar.gz
ext: ""
- os: macos-latest
name: macos-arm64
target: bun-darwin-arm64
archive: tar.gz
ext: ""
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
working-directory: compiler
shell: bash
run: |
bun install
- name: Build zsc binary
working-directory: compiler
shell: bash
run: |
mkdir -p dist
bun build zsc.js \
--compile \
--target=${{ matrix.target }} \
--outfile dist/zsc${{ matrix.ext }}
# -------- Linux / macOS --------
- name: Package (tar.gz)
if: matrix.archive == 'tar.gz'
working-directory: compiler/dist
shell: bash
run: |
chmod +x zsc
tar -czf zsc-${{ matrix.name }}.tar.gz zsc
# -------- Windows --------
- name: Package (zip)
if: matrix.archive == 'zip'
working-directory: compiler/dist
shell: bash
run: |
zip zsc-${{ matrix.name }}.zip zsc.exe
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
files: |
compiler/dist/zsc-${{ matrix.name }}.*