Skip to content

Commit 9ede524

Browse files
Add a workflow for creating releases (#1839)
progress towards [Version 0.0.0](https://github.com/PixelGuys/Cubyz/milestone/2) I also noticed that we don't need to link anything on linux anymore since X11 is statically linked and OpenGL is loaded by glad, so this also fixes #353
1 parent 7ecc50c commit 9ede524

File tree

7 files changed

+48
-11
lines changed

7 files changed

+48
-11
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ jobs:
1414
name: Compilation Check
1515
steps:
1616
- uses: actions/checkout@v3
17+
- run: echo "VERSION=$(cat .zig-version)" >> $GITHUB_ENV
1718
- uses: mlugg/setup-zig@v2
1819
with:
19-
version: 0.15.0-dev.1034+bd97b6618
20-
- run: sudo apt install libgl-dev libasound2-dev libx11-dev glslang-tools
20+
version: ${{ env.VERSION }}
21+
- run: sudo apt install glslang-tools
2122
- run: echo "zigPath=$(command -v zig | sed 's/.\{3\}$//')" >> $GITHUB_ENV
2223
- run: wget -O $zigPath/lib/std/zig/render.zig https://github.com/PixelGuys/Cubyz-std-lib/releases/download/0.15.0-dev.1034+bd97b6618/render.zig
2324
- run: zig build

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Create release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Create release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- run: echo "VERSION=$(cat .zig-version)" >> $GITHUB_ENV
18+
- uses: mlugg/setup-zig@v2
19+
with:
20+
version: ${{ env.VERSION }}
21+
22+
- run: zig build -Dtarget=x86_64-linux-musl -Doptimize=ReleaseFast -Drelease=true -Dcpu=baseline
23+
- run: tar -czf Linux-x86_64.tar.gz --transform 's,^,Cubyz/,' assets/cubyz -C zig-out/bin Cubyz
24+
25+
- run: zig build -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseFast -Drelease=true -Dcpu=baseline
26+
- run: tar -czf Windows-x86_64.tar.gz --transform 's,^,Cubyz/,' assets/cubyz -C zig-out/bin Cubyz.exe
27+
28+
- name: Create release
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
tag: ${{ github.ref_name }}
32+
run: |
33+
gh release create "$tag" \
34+
--repo="$GITHUB_REPOSITORY" \
35+
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \
36+
--generate-notes \
37+
Linux-x86_64.tar.gz \
38+
Windows-x86_64.tar.gz
39+
gh release
File renamed without changes.

build.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ fn linkLibraries(b: *std.Build, exe: *std.Build.Step.Compile, useLocalDeps: bool
5656
exe.linkSystemLibrary("gdi32");
5757
exe.linkSystemLibrary("opengl32");
5858
exe.linkSystemLibrary("ws2_32");
59-
} else if(t.os.tag == .linux) {
60-
exe.linkSystemLibrary("X11");
61-
exe.linkSystemLibrary("GL");
6259
} else if(t.os.tag == .macos) {
6360
exe.linkFramework("AudioUnit");
6461
exe.linkFramework("AudioToolbox");
@@ -71,7 +68,7 @@ fn linkLibraries(b: *std.Build, exe: *std.Build.Step.Compile, useLocalDeps: bool
7168
exe.addRPath(.{.cwd_relative = "/usr/local/GL/lib"});
7269
exe.root_module.addRPathSpecial("@executable_path/../Library");
7370
exe.addRPath(.{.cwd_relative = "/opt/X11/lib"});
74-
} else {
71+
} else if(t.os.tag != .linux) {
7572
std.log.err("Unsupported target: {}\n", .{t.os.tag});
7673
}
7774
}
@@ -180,7 +177,7 @@ pub fn build(b: *std.Build) !void {
180177
});
181178

182179
const exe = b.addExecutable(.{
183-
.name = "Cubyzig",
180+
.name = "Cubyz",
184181
.root_module = mainModule,
185182
//.sanitize_thread = true,
186183
.use_llvm = true,
@@ -218,7 +215,7 @@ pub fn build(b: *std.Build) !void {
218215
// MARK: Formatter
219216

220217
const formatter = b.addExecutable(.{
221-
.name = "CubyzigFormatter",
218+
.name = "CubyzFormatter",
222219
.root_module = b.addModule("format", .{
223220
.root_source_file = b.path("src/formatter/format.zig"),
224221
.target = target,

debug_linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ fi
2424
echo "Cubyz successfully built!"
2525
echo "Launching Cubyz."
2626

27-
./zig-out/bin/Cubyzig
27+
./zig-out/bin/Cubyz

debug_windows.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ if errorlevel 1 (
1919
echo Cubyz successfully built!
2020
echo Launching Cubyz.
2121

22-
zig-out\bin\Cubyzig
22+
zig-out\bin\Cubyz

src/graphics/Window.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ pub fn init() void { // MARK: init()
678678

679679
window = c.glfwCreateWindow(width, height, "Cubyz", null, null) orelse @panic("Failed to create GLFW window");
680680
iconBlock: {
681-
const image = main.graphics.Image.readUnflippedFromFile(main.stackAllocator, "logo.png") catch |err| {
681+
const image = main.graphics.Image.readUnflippedFromFile(main.stackAllocator, "assets/cubyz/logo.png") catch |err| {
682682
std.log.err("Error loading logo: {s}", .{@errorName(err)});
683683
break :iconBlock;
684684
};

0 commit comments

Comments
 (0)