name: Release on: push: tags: - "v*.*.*" jobs: web: name: Build frontend runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: oven-sh/setup-bun@v2 - name: Build admin console run: | cd web bun install --frozen-lockfile bun run build - uses: actions/upload-artifact@v7 with: name: web-dist path: web/dist retention-days: 1 build: name: Build ${{ matrix.name }} needs: web runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: # Linux: cloud servers, x86 NAS (Synology/QNAP/UGREEN/ZSpace...) - name: linux-amd64 goos: linux goarch: amd64 service: sower.service sowerd.service sower.init # Linux: ARM servers (Kunpeng/Graviton), ARM NAS, Raspberry Pi 4/5, routers - name: linux-arm64 goos: linux goarch: arm64 service: sower.service sowerd.service sower.init # Linux: legacy NAS (Synology/QNAP ARM models), Raspberry Pi 2/3 - name: linux-arm goos: linux goarch: arm goarm: "7" service: sower.service sowerd.service sower.init # Linux: emerging RISC-V boards (Orange Pi RV, VisionFive, SG2042) - name: linux-riscv64 goos: linux goarch: riscv64 service: sower.service sowerd.service sower.init # Linux: LoongArch (Loongson) for the local ecosystem - name: linux-loong64 goos: linux goarch: loong64 service: sower.service sowerd.service sower.init # Linux: legacy routers - name: linux-mips goos: linux goarch: mips service: sower.service sowerd.service sower.init - name: linux-mipsle goos: linux goarch: mipsle service: sower.service sowerd.service sower.init # macOS: Intel Macs - name: darwin-amd64 goos: darwin goarch: amd64 service: sower.plist # macOS: Apple Silicon - name: darwin-arm64 goos: darwin goarch: arm64 service: sower.plist # Windows: mainstream x64 - name: windows-amd64 goos: windows goarch: amd64 ext: .exe service: sower_run.vbs # Windows: ARM (Snapdragon X etc.) - name: windows-arm64 goos: windows goarch: arm64 ext: .exe service: sower_run.vbs steps: - uses: actions/checkout@v7 - uses: actions/setup-go@v7 with: go-version: ^1.27 - uses: actions/download-artifact@v8 with: name: web-dist path: web/dist - name: Build binaries env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} GOARM: ${{ matrix.goarm }} CGO_ENABLED: "0" run: | ldflags="-X main.version=$(git describe --tags --always) -X main.date=$(date +%Y-%m-%d)" go build -ldflags "$ldflags" -o sower${{ matrix.ext }} ./cmd/sower go build -ldflags "$ldflags" -o sowerd${{ matrix.ext }} ./cmd/sowerd # The packaging files are copied in only after the build: they land in the # repository root, and the toolchain stamps the worktree state into each # binary, so copying them first published every artifact as a build no # commit can be held to (`vcs.modified=true`, module version `+dirty`). - name: Package run: | cp .github/sower.toml . # matrix.service lists space-separated file names ("sower.service # sowerd.service"); prefix each with .github/ individually. for s in ${{ matrix.service }}; do cp ".github/$s" .; done tar czf sower-${{ matrix.name }}.tar.gz \ sower${{ matrix.ext }} sowerd${{ matrix.ext }} sower.toml \ ${{ matrix.service }} - uses: actions/upload-artifact@v7 with: name: sower-${{ matrix.name }}.tar.gz path: sower-${{ matrix.name }}.tar.gz retention-days: 1 release: name: Attach release assets needs: build runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v8 with: path: artifacts pattern: sower-*.tar.gz merge-multiple: true - name: Generate checksums run: | cd artifacts sha256sum sower-*.tar.gz > SHA256SUMS - uses: ncipollo/release-action@v1 with: artifacts: "artifacts/*.tar.gz,artifacts/SHA256SUMS" token: ${{ secrets.GITHUB_TOKEN }}