Skip to content

Update zsc.js

Update zsc.js #11

Workflow file for this run

name: Build and Release ZScript
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
# ---------- LINUX X64 ----------
- os: ubuntu-latest
name: linux-x64-avx2
target: bun-linux-x64
variant: "-avx2"
- os: ubuntu-latest
name: linux-x64-baseline
target: bun-linux-x64-baseline
variant: "-baseline"
# ---------- LINUX MUSL (Alpine) ----------
- os: ubuntu-latest
name: linux-x64-musl-avx2
target: bun-linux-x64-musl
variant: "-musl-avx2"
- os: ubuntu-latest
name: linux-x64-musl-baseline
target: bun-linux-x64-musl-baseline
variant: "-musl-baseline"
# ---------- LINUX ARM64 ----------
- os: ubuntu-latest
name: linux-arm64
target: bun-linux-arm64
variant: ""
# ---------- WINDOWS X64 ----------
- os: ubuntu-latest # Using Linux to cross-compile Windows prevents extraction errors
name: windows-x64-avx2
target: bun-windows-x64
variant: "-avx2"
- os: ubuntu-latest
name: windows-x64-baseline
target: bun-windows-x64-baseline
variant: "-baseline"
# ---------- MACOS ----------
- os: macos-latest
name: macos-x64-avx2
target: bun-darwin-x64
variant: "-avx2"
- os: macos-latest
name: macos-x64-baseline
target: bun-darwin-x64-baseline
variant: "-baseline"
- os: macos-latest
name: macos-arm64
target: bun-darwin-arm64
variant: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.3.6 # Fixed to the version you specified
- name: Install dependencies
working-directory: compiler
shell: bash
run: bun install
- name: Build binary
working-directory: compiler
shell: bash
run: |
mkdir -p dist
# Bun automatically adds .exe when target is windows
bun build zsc.js \
--bundle \
--compile \
--target=${{ matrix.target }} \
--outfile dist/zsc${{ matrix.variant }}
# -------- Packaging Logic --------
- name: Package Assets
working-directory: compiler/dist
shell: bash
run: |
# Determine if the target was windows to find the right file
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
FILENAME="zsc${{ matrix.variant }}.exe"
# Use zip for Windows
zip zsc-${{ matrix.name }}.zip "$FILENAME"
else
FILENAME="zsc${{ matrix.variant }}"
chmod +x "$FILENAME"
# Use tar.gz for Linux/macOS
tar -czf zsc-${{ matrix.name }}.tar.gz "$FILENAME"
fi
- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
files: |
compiler/dist/*.zip
compiler/dist/*.tar.gz