Skip to content

Commit

Permalink
modified release
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavsijaria committed Oct 31, 2024
1 parent b6783e9 commit 4dd2cd7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
41 changes: 18 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,22 +31,13 @@ jobs:
uses: mlugg/[email protected]

- 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
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit 4dd2cd7

Please sign in to comment.