1name: CI23on:4 push:5 branches: [main]6 tags: ["v*"]7 pull_request:89permissions:10 contents: read1112concurrency:13 group: ci-${{ github.ref }}14 cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}1516env:17 GOFLAGS: -trimpath -buildvcs=false1819jobs:20 checks:21 runs-on: ubuntu-24.0422 steps:23 - uses: actions/checkout@v524 - uses: actions/setup-go@v525 with:26 go-version-file: go.mod27 - uses: actions/setup-node@v428 with:29 node-version: 2430 cache: npm31 cache-dependency-path: frontend/package-lock.json32 - name: Rebuild frontend and confirm committed assets match33 run: |34 npm --prefix frontend ci35 npm --prefix frontend test36 npm --prefix frontend run build37 git diff --exit-code -- assets/38 test -z "$(git status --porcelain assets/)"39 - name: Install GTK and WebKitGTK headers40 run: |41 sudo apt-get update42 sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev43 - name: Vet and test44 run: |45 go vet -tags "desktop,production,webkit2_41" ./...46 go test -tags "desktop,production,webkit2_41" ./...4748 build-linux:49 runs-on: ubuntu-24.0450 steps:51 - uses: actions/checkout@v552 - uses: actions/setup-go@v553 with:54 go-version-file: go.mod55 - name: Install GTK and WebKitGTK headers56 run: |57 sudo apt-get update58 sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev59 - name: Build60 run: |61 VERSION="${GITHUB_REF_NAME}"62 [[ "${GITHUB_REF}" == refs/tags/v* ]] || VERSION="dev-$(git rev-parse --short HEAD)"63 go build -tags "desktop,production,webkit2_41" -ldflags "-w -s" -o Atlas .64 tar -czf "Atlas-${VERSION}-linux-amd64.tar.gz" Atlas65 - uses: actions/upload-artifact@v466 with:67 name: atlas-linux-amd6468 path: Atlas-*-linux-amd64.tar.gz69 if-no-files-found: error7071 build-windows:72 runs-on: ubuntu-24.0473 steps:74 - uses: actions/checkout@v575 - uses: actions/setup-go@v576 with:77 go-version-file: go.mod78 - name: Cross-compile for Windows79 env:80 GOOS: windows81 GOARCH: amd6482 CGO_ENABLED: "0"83 run: |84 VERSION="${GITHUB_REF_NAME}"85 [[ "${GITHUB_REF}" == refs/tags/v* ]] || VERSION="dev-$(git rev-parse --short HEAD)"86 go build -tags "desktop,production" -ldflags "-w -s -H windowsgui" -o Atlas.exe .87 zip "Atlas-${VERSION}-windows-amd64.zip" Atlas.exe88 - uses: actions/upload-artifact@v489 with:90 name: atlas-windows-amd6491 path: Atlas-*-windows-amd64.zip92 if-no-files-found: error9394 build-macos:95 runs-on: macos-1596 steps:97 - uses: actions/checkout@v598 - uses: actions/setup-go@v599 with:100 go-version-file: go.mod101 - name: Build and assemble Atlas.app102 run: |103 VERSION="${GITHUB_REF_NAME}"104 [[ "${GITHUB_REF}" == refs/tags/v* ]] || VERSION="dev-$(git rev-parse --short HEAD)"105 go build -tags "desktop,production" -ldflags "-w -s" -o Atlas .106 mkdir -p Atlas.app/Contents/MacOS107 cp Atlas Atlas.app/Contents/MacOS/Atlas108 cat > Atlas.app/Contents/Info.plist <<EOF109 <?xml version="1.0" encoding="UTF-8"?>110 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">111 <plist version="1.0">112 <dict>113 <key>CFBundleExecutable</key><string>Atlas</string>114 <key>CFBundleIdentifier</key><string>dev.felinestatemachine.atlas</string>115 <key>CFBundleName</key><string>Atlas</string>116 <key>CFBundlePackageType</key><string>APPL</string>117 <key>CFBundleInfoDictionaryVersion</key><string>6.0</string>118 <key>CFBundleShortVersionString</key><string>${VERSION#v}</string>119 <key>LSMinimumSystemVersion</key><string>12.0</string>120 <key>NSHighResolutionCapable</key><true/>121 </dict>122 </plist>123 EOF124 ditto -c -k --keepParent Atlas.app "Atlas-${VERSION}-darwin-arm64.zip"125 - uses: actions/upload-artifact@v4126 with:127 name: atlas-darwin-arm64128 path: Atlas-*-darwin-arm64.zip129 if-no-files-found: error130131 release:132 if: startsWith(github.ref, 'refs/tags/v')133 needs: [checks, build-linux, build-windows, build-macos]134 runs-on: ubuntu-latest135 permissions:136 contents: write137 steps:138 - uses: actions/checkout@v5139 - uses: actions/download-artifact@v4140 with:141 path: dist142 merge-multiple: true143 - name: Create GitHub Release144 env:145 GH_TOKEN: ${{ github.token }}146 run: |147 PRERELEASE=""148 [[ "${GITHUB_REF_NAME}" == *-* ]] && PRERELEASE="--prerelease"149 gh release create "${GITHUB_REF_NAME}" dist/* \150 --title "Atlas ${GITHUB_REF_NAME}" \151 --generate-notes --verify-tag ${PRERELEASE}