From 3621a367a6e017d9bdf141e506377360c53ae45d Mon Sep 17 00:00:00 2001 From: TyostoKarry <114697841+TyostoKarry@users.noreply.github.com> Date: Sun, 29 Mar 2026 16:49:38 +0300 Subject: [PATCH 1/2] Add goreleaser release pipeline - Add `.goreleaser.yaml` to build for linux/mac/windows (amd64 + arm64) - Add release workflow triggered on `v*` tags - Change `version` from const to var to support ldflags injection at build time --- .github/workflows/release.yml | 32 +++++++++++++++++++++++++++++ .goreleaser.yaml | 38 +++++++++++++++++++++++++++++++++++ main.go | 2 +- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1ebea13 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + release: + name: Release + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v7 + with: + distribution: goreleaser + version: '~> v2' + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..17d4922 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,38 @@ +version: 2 + +project_name: sleepycli + +before: + hooks: + - go mod download + +builds: + - env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -s -w -X main.version={{.Version}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + +archives: + - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + format_overrides: + - goos: windows + formats: + - zip + +extra_files: + - glob: scripts/sleepycli-completion.bash + +checksum: + name_template: "checksums.txt" + +release: + draft: false diff --git a/main.go b/main.go index 392924b..4c1ecdc 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ import ( "github.com/spf13/pflag" ) -const version = "1.0.0" +var version = "dev" func main() { help.SetupCustomHelp() From 96f67813c7a28b88babcac20d08c9379902474e6 Mon Sep 17 00:00:00 2001 From: TyostoKarry <114697841+TyostoKarry@users.noreply.github.com> Date: Sun, 29 Mar 2026 16:49:57 +0300 Subject: [PATCH 2/2] Update verify-pr to utilize actions/checkout@v6 --- .github/workflows/verify-pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify-pr.yml b/.github/workflows/verify-pr.yml index 9ec2d14..1b81950 100644 --- a/.github/workflows/verify-pr.yml +++ b/.github/workflows/verify-pr.yml @@ -12,7 +12,7 @@ jobs: timeout-minutes: 5 steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v6 @@ -30,7 +30,7 @@ jobs: timeout-minutes: 5 steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v6