From 4dd2cd77b52ad71b711b1391e9a5a8240903bbdb Mon Sep 17 00:00:00 2001 From: Vaibhav Sijaria <139199971+vaibhavsijaria@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:47:47 +0530 Subject: [PATCH] modified release --- .github/workflows/release.yml | 41 +++++++++++++++-------------------- build.zig | 8 +++++-- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55fb413..6f95a6b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,19 +7,21 @@ on: jobs: build: - name: Build on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + name: Build + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - include: - - os: ubuntu-latest - artifact_name: ziglox-linux-amd64 - - os: windows-latest - artifact_name: ziglox-windows-amd64.exe - - os: macos-latest - artifact_name: ziglox-macos-amd64 + target: + - x86_64-linux + - x86_64-macos + - x86_64-windows + - aarch64-linux + - aarch64-macos + - aarch64-windows + - riscv64-linux + - powerpc64le-linux + - mips64-linux steps: - name: Checkout code @@ -29,22 +31,13 @@ jobs: uses: mlugg/setup-zig@v1.2.1 - name: Build - run: zig build -Doptimize=ReleaseSafe + run: zig build -Doptimize=ReleaseSafe -Dtarget=${{ matrix.target }} - - name: Rename binary - shell: bash - run: | - if [ "${{ matrix.os }}" == "windows-latest" ]; then - mv zig-out/bin/ziglox.exe zig-out/bin/${{ matrix.artifact_name }} - else - mv zig-out/bin/ziglox zig-out/bin/${{ matrix.artifact_name }} - fi - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: ${{ matrix.artifact_name }} - path: zig-out/bin/${{ matrix.artifact_name }} - if-no-files-found: error + name: zlox-${{ matrix.target }} + path: ./zig-out/bin/zlox-${{ matrix.target }}${{ contains(matrix.target, 'windows') && '.exe' || '' }} release: needs: build @@ -60,13 +53,15 @@ jobs: run: | find release-assets -type f -exec mv {} release-assets/ \; find release-assets -type d -empty -delete + - name: Generate SHA256 checksums run: | cd release-assets sha256sum * > SHA256SUMS.txt + - name: Create release notes run: | - echo "## Ziglox ${{ github.ref_name }}" > release-notes.md + echo "## zlox ${{ github.ref_name }}" > release-notes.md echo "" >> release-notes.md echo "**SHA256 Checksums**:" >> release-notes.md echo '```' >> release-notes.md diff --git a/build.zig b/build.zig index fd8af7e..39a9159 100644 --- a/build.zig +++ b/build.zig @@ -1,11 +1,15 @@ const std = @import("std"); -pub fn build(b: *std.Build) void { +pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const exe = b.addExecutable(.{ - .name = "ziglox", + .name = try std.fmt.allocPrint( + std.heap.page_allocator, + "zlox-{s}-{s}", + .{ @tagName(target.result.cpu.arch), @tagName(target.result.os.tag) }, + ), .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize,