Add GitHub Actions workflow for build and release #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| - os: ubuntu-latest | |
| name: linux-x64-baseline | |
| target: bun-linux-x64-baseline | |
| # ---------- LINUX MUSL (Alpine) ---------- | |
| - os: ubuntu-latest | |
| name: linux-x64-musl-avx2 | |
| target: bun-linux-x64-musl | |
| - os: ubuntu-latest | |
| name: linux-x64-musl-baseline | |
| target: bun-linux-x64-musl-baseline | |
| # ---------- LINUX ARM64 ---------- | |
| - os: ubuntu-latest | |
| name: linux-arm64 | |
| target: bun-linux-arm64 | |
| # ---------- WINDOWS X64 ---------- | |
| - os: ubuntu-latest | |
| name: windows-x64-avx2 | |
| target: bun-windows-x64 | |
| - os: ubuntu-latest | |
| name: windows-x64-baseline | |
| target: bun-windows-x64-baseline | |
| # ---------- MACOS ---------- | |
| - os: macos-latest | |
| name: macos-x64-avx2 | |
| target: bun-darwin-x64 | |
| - os: macos-latest | |
| name: macos-x64-baseline | |
| target: bun-darwin-x64-baseline | |
| - os: macos-latest | |
| name: macos-arm64 | |
| target: bun-darwin-arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: 1.3.6 | |
| - name: Install dependencies | |
| # Updated path to new src/compiler directory | |
| working-directory: src/compiler | |
| shell: bash | |
| run: bun install | |
| - name: Build binary | |
| working-directory: src/compiler | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| # We compile to 'zsc' or 'zsc.exe' exactly as requested | |
| if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| OUTFILE="dist/zsc.exe" | |
| else | |
| OUTFILE="dist/zsc" | |
| fi | |
| bun build zsc.js \ | |
| --bundle \ | |
| --compile \ | |
| --target=${{ matrix.target }} \ | |
| --outfile "$OUTFILE" | |
| # -------- Packaging Logic -------- | |
| - name: Package Assets | |
| working-directory: src/compiler/dist | |
| shell: bash | |
| run: | | |
| if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| # Archive contains 'zsc.exe' but zip is named by platform | |
| zip zsc-${{ matrix.name }}.zip zsc.exe | |
| else | |
| chmod +x zsc | |
| tar -czf zsc-${{ matrix.name }}.tar.gz zsc | |
| fi | |
| - name: Upload Release Assets | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| src/compiler/dist/*.zip | |
| src/compiler/dist/*.tar.gz |