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/.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 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()