-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (129 loc) · 5.9 KB
/
Copy pathrelease.yml
File metadata and controls
139 lines (129 loc) · 5.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Release
# chartplotter publishes per-platform binaries on every v* tag. The binary is a
# CGO build that statically links the native libtile57 engine and can't be
# cross-compiled by an off-the-shelf builder, so the binaries are cross-built HERE,
# then a plain shell step archives + checksums + releases them:
#
# xbuild (ubuntu) → linux + windows, amd64/arm64 via `make xbuild` (zig cc)
# release (ubuntu) → downloads the artifact set, archives + checksums + release
#
# macOS is intentionally NOT built: with GOOS=darwin, Go's crypto/x509 + runtime/cgo
# link Apple's Security/CoreFoundation frameworks, which Zig doesn't bundle, so darwin
# can't be cross-built with zig cc and would need a paid macOS runner. Mac users build
# from source per the README.
#
# The engine is the public github.com/beetlebugorg/tile57 (its submodules hold the
# IHO S-101 catalogues); it is the ./tile57 git submodule so go.mod's
# ./tile57/bindings/go replace and the binding's cgo LDFLAGS resolve — the same
# layout as ci.yml. `submodules: recursive` checks it out at the committed pin, then
# it's floated to the engine's latest main. main.version + main.engineCommit are
# stamped into every binary via ldflags (preserved across both jobs).
#
# Packaging is plain shell (tar/zip + checksums + gh release) — no GoReleaser, no
# paid license — so nothing here depends on a GoReleaser Pro key.
#
# NOTE: correct-by-construction but UNVALIDATED until a real v* tag is pushed —
# nothing runs on push/PR, and packaging needs the CI-built binaries.
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
# ---- linux + windows (amd64/arm64): CGO cross-compile with zig cc -------------
xbuild:
runs-on: ubuntu-latest
steps:
- name: Checkout chartplotter (+ tile57 engine submodule)
uses: actions/checkout@v7
with:
path: chartplotter
fetch-depth: 0
# ./tile57 submodule (go.mod replaces the binding at ./tile57/bindings/go);
# its own submodules carry the IHO catalogues.
submodules: recursive
- name: Float tile57 submodule to latest main
run: |
git -C chartplotter submodule update --remote tile57
git -C chartplotter submodule update --init --recursive tile57
- uses: actions/setup-go@v6
with:
go-version: "1.26"
cache: true
cache-dependency-path: chartplotter/go.sum
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0
# xbuild-tile57.sh builds libtile57 per target with zig, then links each
# binary with `zig cc`, emitting dist/chartplotter_${goos}_${goarch}${ext}
# (ext=.exe for windows) for linux+windows amd64/arm64, stamping VERSION +
# ENGINE_COMMIT (the Makefile derives ENGINE_COMMIT from the tile57 submodule HEAD).
- name: Cross-build linux + windows binaries
run: make -C chartplotter xbuild TILE57=tile57 VERSION="${{ github.ref_name }}"
- name: Upload linux + windows binaries
uses: actions/upload-artifact@v7
with:
name: binaries-xbuild
path: chartplotter/dist/chartplotter_*
if-no-files-found: error
# ---- package + publish: plain shell (no GoReleaser, no paid license) ---------
# The binaries are already built by the xbuild job above; this just archives each
# (tar.gz for unix, zip for windows), writes checksums.txt, and creates the
# GitHub release with all of it attached. (GoReleaser's prebuilt builder would do
# the same packaging but is Pro-only; shell keeps the release path license-free.)
release:
runs-on: ubuntu-latest
needs: [xbuild]
steps:
- name: Checkout chartplotter
uses: actions/checkout@v7
with:
path: chartplotter
fetch-depth: 0
# Land all four prebuilt binaries into dist/ (naming: chartplotter_{os}_{arch}
# [.exe], from xbuild-tile57.sh — linux + windows, amd64/arm64).
- name: Download prebuilt binaries
uses: actions/download-artifact@v8
with:
name: binaries-xbuild
path: chartplotter/dist
# Archive each binary alongside README + LICENSE + THIRD-PARTY-NOTICES, then
# one checksums.txt over the archives. tar.gz for unix, zip for windows.
# upload-artifact drops the exec bit, so it's restored before archiving.
- name: Package archives + checksums
working-directory: chartplotter
run: |
set -euo pipefail
tag="${{ github.ref_name }}"
out=release-assets
mkdir -p "$out"
for bin in dist/chartplotter_*; do
base="$(basename "$bin")" # chartplotter_linux_amd64[.exe]
platform="${base#chartplotter_}" # linux_amd64[.exe]
stage="$(mktemp -d)"
cp README.md LICENSE THIRD-PARTY-NOTICES.md "$stage/"
if [ "${base##*.}" = "exe" ]; then
platform="${platform%.exe}"
cp "$bin" "$stage/chartplotter.exe"
( cd "$stage" && zip -q -r - . ) > "$out/chartplotter_${tag}_${platform}.zip"
else
cp "$bin" "$stage/chartplotter"
chmod +x "$stage/chartplotter"
tar -czf "$out/chartplotter_${tag}_${platform}.tar.gz" -C "$stage" .
fi
rm -rf "$stage"
done
( cd "$out" && sha256sum chartplotter_* > checksums.txt )
ls -1 "$out"
- name: Create GitHub release
working-directory: chartplotter
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" \
--verify-tag \
--generate-notes \
--notes "Linux + Windows binaries (amd64/arm64) below. Each embeds the IHO S-101 catalogue (via the tile57 engine) — see THIRD-PARTY-NOTICES.md. macOS is not shipped as a binary; build from source per the README." \
release-assets/*