From ecd57850ae7e40331aa7e457ae020475954e1b9f Mon Sep 17 00:00:00 2001 From: Drew Smirnoff Date: Mon, 23 Mar 2026 23:01:52 +0400 Subject: [PATCH] ci: create nightly releases (#382) --- .github/workflows/nightly.yml | 51 ++++++++++++++++++++++++++ .goreleaser.nightly.yml | 69 +++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 .github/workflows/nightly.yml create mode 100644 .goreleaser.nightly.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000000000000000000000000000000000..3f6085f0ede76f7c09cea6952270079b0a9c7e21 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,51 @@ +name: Nightly Release + +on: + push: + branches: + - master + workflow_dispatch: + +permissions: + contents: write + +jobs: + nightly: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.1" + + - name: Set up Zig + uses: goto-bus-stop/setup-zig@v2 + + - name: Delete existing nightly release and tag + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release delete nightly --yes --cleanup-tag || true + + - name: Create nightly tag + run: | + git tag -f nightly + git push -f origin nightly + + - name: Get macOS SDK path + id: macos_sdk + run: echo "path=$(xcrun --show-sdk-path)" >> $GITHUB_OUTPUT + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v7 + with: + version: latest + args: release --clean --config .goreleaser.nightly.yml + env: + SDK_PATH: ${{ steps.macos_sdk.outputs.path }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.nightly.yml b/.goreleaser.nightly.yml new file mode 100644 index 0000000000000000000000000000000000000000..f16a46933822c234ae68fb5dfcf5018476d5b395 --- /dev/null +++ b/.goreleaser.nightly.yml @@ -0,0 +1,69 @@ +# GoReleaser configuration for nightly builds. +# This is a stripped-down version of .goreleaser.yml that skips +# Homebrew, WinGet, and Snapcraft publishing. +version: 2 + +before: + hooks: + - go mod tidy + +builds: + - id: matcha + main: . + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + flags: + - -trimpath + ldflags: + - -s -w -buildid= -X main.version=nightly-{{.ShortCommit}} -X main.commit={{.Commit}} -X main.date={{.Date}} + env: + - CGO_ENABLED=1 + - >- + {{- if eq .Os "darwin" }}SDKROOT={{ .Env.SDK_PATH }}{{- end }} + - >- + {{- if eq .Os "darwin" }}MACOSX_DEPLOYMENT_TARGET=11.0{{- end }} + - >- + {{- if eq .Os "darwin" }}CGO_CFLAGS=-isysroot {{ .Env.SDK_PATH }} -mmacosx-version-min=11.0{{- end }} + - >- + {{- if eq .Os "darwin" }}CGO_LDFLAGS=-isysroot {{ .Env.SDK_PATH }}{{- end }} + - >- + {{- if eq .Os "darwin" }} + {{- if eq .Arch "amd64"}}CC=clang -arch x86_64 -isysroot {{ .Env.SDK_PATH }}{{- end }} + {{- if eq .Arch "arm64"}}CC=clang -arch arm64 -isysroot {{ .Env.SDK_PATH }}{{- end }} + {{- else if eq .Os "linux" }} + {{- if eq .Arch "amd64" }}CC=zig cc -target x86_64-linux-musl -lc{{- end }} + {{- if eq .Arch "arm64"}}CC=zig cc -target aarch64-linux-musl -lc{{- end }} + {{- else if eq .Os "windows" }} + {{- if eq .Arch "amd64" }}CC=zig cc -target x86_64-windows-gnu -lc{{- end }} + {{- if eq .Arch "arm64"}}CC=zig cc -target aarch64-windows-gnu -lc{{- end }} + {{- end }} + +archives: + - formats: [tar.gz] + name_template: "{{ .ProjectName }}_nightly_{{ .Os }}_{{ .Arch }}" + format_overrides: + - goos: windows + formats: ["zip"] + files: + - LICENSE + - README.md + +checksum: + name_template: "checksums.txt" + +changelog: + use: github-native + +release: + draft: false + prerelease: true + name_template: "Nightly Build ({{ .ShortCommit }})" + footer: | + --- + This is an automated nightly build from the latest `master` commit. + It may be unstable — use stable releases for production.