Files
creamlike1024 e9c2b889f3 ci: take the version from git tags, build every push
The version is no longer kept by hand in mygo.json, which now says
0.0.0-dev. scripts/version.sh computes it from the git tags: a release
tag x.y.z[-pre] is the version, a later commit a snapshot such as
0.9.2.r12.ga4e79e0 (with .dirty for uncommitted changes), which sorts
after its tag and before the next release for dpkg, rpm and pacman,
and is the pkgver of an Arch -git package as it is. The snapshot has
no "+", which mygo turns into "~" for dpkg. EASYLPAC_VERSION overrides
it. scripts/with-version.sh writes the version into mygo.json for one
command and restores the file; the build scripts and CI build through
it.

The release workflow becomes build.yaml: pushes to master and
release/**, pull requests and manual runs are tested and built, with
the packages as artifacts; a pushed release tag also publishes the
GitHub Release (a pre-release for x.y.z-*). Other tags no longer
trigger it. The READMEs describe the versions and the release steps.
2026-11-21 23:44:47 +08:00

34 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the EasyLPAC app for this machine's platform: the static
# libeuicc, then the app bundle and installer with MyGo. Extra arguments go
# to `mygo build`. The eUICC data embedded is the one committed in
# internal/registry/data: builds never download it (to update it, run
# scripts/update-euicc-data.sh and commit the result). The version is the
# one scripts/version.sh gives from the git tags (EASYLPAC_VERSION sets it).
#
# ./scripts/build-app.sh # release build, build/<os>-<arch>/
#
# Release builds never contain the simulated card; build it with
# scripts/build-demo.sh.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
for a in "$@"; do
if [ "$a" = --demo ]; then
echo "build-app.sh: --demo moved to scripts/build-demo.sh" >&2
exit 2
fi
done
if [ ! -f "third_party/libeuicc/$(go env GOOS)-$(go env GOARCH)/libeuicc.a" ]; then
./scripts/build-libeuicc.sh
fi
# zig compiles the C code, as in CI.
export CC="$ROOT/scripts/zcc"
# mygo_nowebview: every window is native UI, so Windows builds leave
# WebView2 out (the tag does nothing on other platforms).
# The version comes from git (scripts/version.sh), not from mygo.json.
GOFLAGS="${GOFLAGS:+$GOFLAGS }-tags=mygo_nowebview" CGO_ENABLED=1 \
./scripts/with-version.sh go run github.com/egoist/mygo/cmd/mygo@v0.10.0 build "$@"