name: release on: push: branches: [main] workflow_dispatch: {} permissions: contents: write jobs: build-and-release: runs-on: ubuntu-latest # The binary must be pure Go (no cgo); pinning this makes every go command # below type-check and build exactly what build.sh builds, regardless of # which C compilers happen to exist on the runner. env: CGO_ENABLED: "0" steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version-file: go.mod # Sanity checks before shipping a binary. - name: Vet (windows target) run: GOOS=windows GOARCH=amd64 go vet ./... # Pure packages only; the GUI code cannot be exercised on Linux. - name: Test pure packages run: go test ./auth/... ./config/... ./dalamud/... ./sqex/... ./logx/... # Mirror build.sh exactly, including the buildID stamp that # launcher.log's first line reports at startup. - name: Build windows/amd64 run: | buildid=$(git rev-parse --short HEAD) mkdir -p dist CGO_ENABLED=0 GOOS=windows GOARCH=amd64 \ go build -trimpath -ldflags="-s -w -X main.buildID=$buildid" \ -o "dist/ffxiv-tiny-launcher-windows_amd64.exe" . echo "built dist exe (buildID=$buildid)" # Tag = short commit hash, so the release tag always matches the buildID # baked into the exe and printed in launcher.log. - name: Create GitHub release env: GH_TOKEN: ${{ github.token }} run: | tag=$(git rev-parse --short HEAD) subject=$(git log -1 --pretty=%s) # A re-run of this workflow on the same commit must not fail on an # existing tag/release. gh release delete "$tag" --cleanup-tag --yes >/dev/null 2>&1 || true notes=$(printf 'Built from %s - %s\n\n- ffxiv-tiny-launcher-windows_amd64.exe (buildID=%s)' \ "$GITHUB_SHA" "$subject" "$tag") gh release create "$tag" --prerelease --title "Build $tag" \ --notes "$notes" dist/ffxiv-tiny-launcher-windows_amd64.exe