clone

an offline map explorer where each world, from a game map to a city's open data, ships as one .atlas file

main
atlas / .github / workflows / release.yml
release.yml 8.8K
1# The release recipe (issue #5 §7, M7).2#3# Two things ship from this repository, and this workflow builds both.4#5# atlas the CLI: crawl, tiles, translate, compose, enrich, measure,6# workbench, serve, dev. Pure Go, CGO_ENABLED=0, cross-compiled for7# five targets from one runner.8# Atlas the desktop application: the hypermedia app in a webview (§3.4).9# It links a native webview, so it is built on the platform it runs10# on -- except Windows, which cross-compiles because WebView2 is11# loaded from the machine at runtime rather than linked.12#13# It replaces ci.yml, which built and released the pre-rewrite desktop shell on14# `v*` tags until the old tree was archived at close-out. `v*` answers here15# now. `atlas-v*` is still accepted -- it is the tag the CLI shipped under16# while the desktop host was a TODO in this file -- and means the same thing.17#18# The recipe carried from ci.yml, unchanged where it was already right:19#20# - version from the tag, `dev-<short sha>` off a tag;21# - `-trimpath` and `-ldflags "-s -w"`, so a build is a function of its22# inputs and carries no local paths;23# - one archive per platform: .tar.gz for the unix targets, .zip for Windows;24# - the macOS .app assembled by hand -- Contents/MacOS plus an Info.plist25# naming dev.felinestatemachine.atlas, LSMinimumSystemVersion 12.0,26# NSHighResolutionCapable -- and packed with `ditto -c -k --keepParent`,27# because there is no wails.json and no Wails CLI in this tree (docs/app.md28# §1.4);29# - a release job gated on the tag, `--generate-notes --verify-tag`, and a30# prerelease when the version carries a hyphen.31#32# The one addition is the seam. `make static` builds render/ and installs the33# bundle where the shell embeds it, so a desktop build runs it first; the CLI34# needs none of that, which is the deletability principle showing up in the35# release recipe.3637name: Release3839on:40 push:41 tags: ["v*", "atlas-v*"]42 workflow_dispatch:43 inputs:44 version:45 description: "version label for a dispatched build, e.g. v0.1.0"46 required: false47 type: string4849permissions:50 contents: read5152concurrency:53 group: release-${{ github.ref }}54 cancel-in-progress: false5556env:57 GOFLAGS: -trimpath -buildvcs=false5859jobs:60 cli:61 name: atlas ${{ matrix.goos }}/${{ matrix.goarch }}62 runs-on: ubuntu-24.0463 env:64 CGO_ENABLED: "0"65 strategy:66 fail-fast: false67 matrix:68 include:69 - { goos: linux, goarch: amd64 }70 - { goos: linux, goarch: arm64 }71 - { goos: darwin, goarch: arm64 }72 - { goos: darwin, goarch: amd64 }73 - { goos: windows, goarch: amd64 }74 steps:75 - uses: actions/checkout@v576 - uses: actions/setup-go@v577 with:78 go-version-file: go.mod7980 - name: Build81 env:82 GOOS: ${{ matrix.goos }}83 GOARCH: ${{ matrix.goarch }}84 run: |85 VERSION="${GITHUB_REF_NAME#atlas-}"86 if [[ "${GITHUB_REF}" != refs/tags/* ]]; then87 VERSION="${{ inputs.version }}"88 [[ -n "${VERSION}" ]] || VERSION="dev-$(git rev-parse --short HEAD)"89 fi90 # "atlas-cli-", not "atlas-": GitHub release asset names are91 # case-insensitively unique, so a CLI archive spelled "atlas-…"92 # collides with the desktop's "Atlas-…" wherever the two share a93 # platform and an extension — which is exactly how v0.1.0's release94 # job died half-published. The prefix also reads better to a person95 # deciding which file they want.96 NAME="atlas-cli-${VERSION}-${GOOS}-${GOARCH}"97 BINARY="atlas"98 if [[ "${GOOS}" == "windows" ]]; then BINARY="atlas.exe"; fi99 mkdir -p "dist/${NAME}"100 go build -ldflags "-s -w" -o "dist/${NAME}/${BINARY}" ./cmd/atlas101 cp README.md LICENSE "dist/${NAME}/"102 cd dist103 if [[ "${GOOS}" == "windows" ]]; then104 zip -qr "${NAME}.zip" "${NAME}"105 else106 tar -czf "${NAME}.tar.gz" "${NAME}"107 fi108109 - uses: actions/upload-artifact@v4110 with:111 name: atlas-${{ matrix.goos }}-${{ matrix.goarch }}112 path: |113 dist/*.tar.gz114 dist/*.zip115 if-no-files-found: error116117 desktop:118 name: Atlas ${{ matrix.target }}119 runs-on: ${{ matrix.os }}120 strategy:121 fail-fast: false122 matrix:123 include:124 - target: linux-amd64125 os: ubuntu-24.04126 tags: "desktop,production,webkit2_41"127 cgo: "1"128 - target: windows-amd64129 os: ubuntu-24.04130 goos: windows131 tags: "desktop,production"132 cgo: "0"133 # -H windowsgui is what stops a console window opening behind the134 # application.135 ldflags: "-H windowsgui"136 - target: darwin-arm64137 os: macos-15138 tags: "desktop,production"139 cgo: "1"140 steps:141 - uses: actions/checkout@v5142 - uses: actions/setup-go@v5143 with:144 go-version-file: go.mod145 - uses: actions/setup-node@v4146 with:147 node-version: "24"148 cache: npm149 cache-dependency-path: package-lock.json150151 # The seam, built and installed where main.go embeds it. Without this152 # step the application still builds and still runs -- it would ship153 # without a viewport, which is the deletability principle rather than an154 # accident -- so the step asserts its own output, to be noticed if it155 # ever silently stops producing one.156 - name: Build the seam into the shell's static tree157 run: |158 npm ci --ignore-scripts159 make static160 test -s static/app.js161162 - name: Install GTK and WebKitGTK headers163 if: matrix.target == 'linux-amd64'164 run: |165 sudo apt-get update166 sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev167168 - name: Build169 env:170 GOOS: ${{ matrix.goos }}171 CGO_ENABLED: ${{ matrix.cgo }}172 run: |173 VERSION="${GITHUB_REF_NAME#atlas-}"174 if [[ "${GITHUB_REF}" != refs/tags/* ]]; then175 VERSION="${{ inputs.version }}"176 [[ -n "${VERSION}" ]] || VERSION="dev-$(git rev-parse --short HEAD)"177 fi178 NAME="Atlas-${VERSION}-${{ matrix.target }}"179180 BINARY="Atlas"181 if [[ "${{ matrix.target }}" == windows-* ]]; then BINARY="Atlas.exe"; fi182 go build -tags "${{ matrix.tags }}" \183 -ldflags "-s -w ${{ matrix.ldflags }}" -o "${BINARY}" .184185 mkdir -p dist186 case "${{ matrix.target }}" in187 windows-*)188 zip -q "dist/${NAME}.zip" Atlas.exe189 ;;190 linux-*)191 tar -czf "dist/${NAME}.tar.gz" Atlas192 ;;193 darwin-*)194 mkdir -p Atlas.app/Contents/MacOS195 cp Atlas Atlas.app/Contents/MacOS/Atlas196 cat > Atlas.app/Contents/Info.plist <<EOF197 <?xml version="1.0" encoding="UTF-8"?>198 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">199 <plist version="1.0">200 <dict>201 <key>CFBundleExecutable</key><string>Atlas</string>202 <key>CFBundleIdentifier</key><string>dev.felinestatemachine.atlas</string>203 <key>CFBundleName</key><string>Atlas</string>204 <key>CFBundlePackageType</key><string>APPL</string>205 <key>CFBundleInfoDictionaryVersion</key><string>6.0</string>206 <key>CFBundleShortVersionString</key><string>${VERSION#v}</string>207 <key>LSMinimumSystemVersion</key><string>12.0</string>208 <key>NSHighResolutionCapable</key><true/>209 </dict>210 </plist>211 EOF212 ditto -c -k --keepParent Atlas.app "dist/${NAME}.zip"213 ;;214 esac215216 - uses: actions/upload-artifact@v4217 with:218 name: Atlas-${{ matrix.target }}219 path: |220 dist/*.tar.gz221 dist/*.zip222 if-no-files-found: error223224 release:225 if: startsWith(github.ref, 'refs/tags/')226 needs: [cli, desktop]227 runs-on: ubuntu-24.04228 permissions:229 contents: write230 steps:231 - uses: actions/checkout@v5232 - uses: actions/download-artifact@v4233 with:234 path: dist235 merge-multiple: true236 - name: Create the GitHub release237 env:238 GH_TOKEN: ${{ github.token }}239 run: |240 # A hyphen in the version itself -- v0.2.0-rc1 -- is a prerelease.241 VERSION="${GITHUB_REF_NAME#atlas-}"242 PRERELEASE=""243 if [[ "${VERSION#v}" == *-* ]]; then PRERELEASE="--prerelease"; fi244 gh release create "${GITHUB_REF_NAME}" dist/* \245 --title "Atlas ${VERSION}" \246 --generate-notes --verify-tag ${PRERELEASE}