Skip to content

Commit cf1ada3

Browse files
feat: GitHub Actions Windows release workflow (tag-triggered only)
- .github/workflows/release.yml: triggered on git push tag v* - Windows Server 2022 with MSYS2 + GTK4 - Downloads latest Zig master - zig build → packages exe + DLLs + assets into zip - Creates GitHub Release with portable zip - scripts/publish.sh: simplified — just pushes a tag, GH Actions handles the rest - No CI on every commit — release only, on tag push, free tier Publish a release: bash scripts/publish.sh # pushes tag → GitHub builds → release appears # https://github.com/4cecoder/metanoia/releases
1 parent d4f8044 commit cf1ada3

2 files changed

Lines changed: 71 additions & 60 deletions

File tree

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
jobs:
8+
build:
9+
runs-on: windows-latest
10+
defaults:
11+
run:
12+
shell: msys2 {0}
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup MSYS2
18+
uses: msys2/setup-msys2@v2
19+
with:
20+
msystem: UCRT64
21+
update: true
22+
install: >
23+
mingw-w64-ucrt-x86_64-gtk4
24+
mingw-w64-ucrt-x86_64-pkg-config
25+
mingw-w64-ucrt-x86_64-sqlite3
26+
mingw-w64-ucrt-x86_64-curl
27+
mingw-w64-ucrt-x86_64-nsis
28+
29+
- name: Install Zig
30+
shell: pwsh
31+
run: |
32+
$json = Invoke-RestMethod https://ziglang.org/download/index.json
33+
$url = $json.master."x86_64-windows".tarball
34+
$zip = "$env:TEMP\zig.zip"
35+
Invoke-WebRequest -Uri $url -OutFile $zip
36+
Expand-Archive $zip -DestinationPath "$env:USERPROFILE\zig" -Force
37+
$dir = (Get-ChildItem "$env:USERPROFILE\zig" -Recurse -Filter "zig.exe").DirectoryName
38+
echo "$dir" | Out-File $env:GITHUB_PATH -Append
39+
40+
- name: Build
41+
shell: pwsh
42+
run: |
43+
$env:PATH += ";C:\msys64\ucrt64\bin"
44+
zig build
45+
46+
- name: Package
47+
shell: pwsh
48+
run: |
49+
# Collect exe + DLLs
50+
$dist = "dist\Metanoia"
51+
New-Item $dist -ItemType Directory -Force
52+
Copy-Item "zig-out\bin\*" $dist -Recurse
53+
Copy-Item "assets\metanoia.ico" $dist
54+
Compress-Archive -Path "$dist\*" -DestinationPath "dist\Metanoia-$env:GITHUB_REF_NAME.zip"
55+
56+
- name: Release
57+
uses: softprops/action-gh-release@v2
58+
with:
59+
files: dist/Metanoia-*.zip
60+
generate_release_notes: true

scripts/publish.sh

Lines changed: 11 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,20 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# Publish latest build to GitHub Releases
5-
# Requires: gh CLI (https://cli.github.com)
6-
# Run after: bash ci/run-windows.sh (or local zig build + scripts/package.sh)
4+
# Publish a new release.
5+
# This pushes a git tag, which triggers .github/workflows/release.yml
6+
# to build on Windows and create the GitHub Release automatically.
77

88
GREEN='\033[0;32m'; YELLOW='\033[1;33m'; NC='\033[0m'
99
info() { echo -e "${GREEN}${NC} $1"; }
10-
warn() { echo -e "${YELLOW}${NC} $1"; }
1110

12-
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
13-
cd "$ROOT"
11+
VERSION="v$(date +%Y.%m.%d)-$(git rev-parse --short HEAD)"
1412

15-
# ── Check prerequisites ────────────────────────────────────────
16-
if ! command -v gh &>/dev/null; then
17-
warn "gh CLI not found. Install: https://cli.github.com"
18-
warn "Then: gh auth login"
19-
exit 1
20-
fi
13+
info "Tagging: $VERSION"
14+
git tag "$VERSION"
15+
git push origin "$VERSION"
2116

22-
if ! gh auth status &>/dev/null; then
23-
warn "Not authenticated. Run: gh auth login"
24-
exit 1
25-
fi
26-
27-
# ── Determine version ──────────────────────────────────────────
28-
VERSION="$(git describe --tags --always --dirty 2>/dev/null || echo "v0.0.0-$(git rev-parse --short HEAD)")"
29-
TAG="$VERSION"
30-
31-
# ── Build if needed ────────────────────────────────────────────
32-
if [ ! -f "zig-out/bin/metanoia.exe" ]; then
33-
info "Building..."
34-
zig build 2>&1
35-
bash scripts/package.sh
36-
fi
37-
38-
# ── Find the installer or dist folder ───────────────────────────
39-
INSTALLER=$(ls dist/Metanoia-Setup-*.exe 2>/dev/null | head -1)
40-
DIST_ZIP="dist/Metanoia-${VERSION}.zip"
41-
42-
if [ ! -f "$INSTALLER" ]; then
43-
warn "No NSIS installer found — creating portable zip"
44-
if [ ! -d "dist/Metanoia" ]; then
45-
warn "No dist folder. Run: scripts/package.sh"
46-
exit 1
47-
fi
48-
(cd dist && zip -r "../$DIST_ZIP" Metanoia/)
49-
UPLOAD="$DIST_ZIP"
50-
NOTES="Portable build (no installer) — unzip and run metanoia.exe"
51-
else
52-
UPLOAD="$INSTALLER"
53-
NOTES="NSIS installer — run Metanoia-Setup-*.exe to install"
54-
fi
55-
56-
# ── Create GitHub Release ───────────────────────────────────────
57-
info "Creating GitHub release: $TAG..."
58-
gh release create "$TAG" \
59-
"$UPLOAD" \
60-
--title "Metanoia $VERSION" \
61-
--notes "$NOTES" \
62-
--generate-notes 2>&1 || {
63-
# Release exists — update instead
64-
info "Release exists — uploading asset..."
65-
gh release upload "$TAG" "$UPLOAD" --clobber 2>&1
66-
}
67-
68-
info "Published: https://github.com/4cecoder/metanoia/releases/tag/$TAG"
69-
info "Done."
17+
info "GitHub Actions will build Windows release at:"
18+
info " https://github.com/4cecoder/metanoia/actions"
19+
info "When complete, release appears at:"
20+
info " https://github.com/4cecoder/metanoia/releases/tag/$VERSION"

0 commit comments

Comments
 (0)