Skip to content

Commit 7ff80ff

Browse files
committed
ci: add GoReleaser workflow for go-cli releases
1 parent 2bd68e7 commit 7ff80ff

4 files changed

Lines changed: 131 additions & 2 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release Go CLI
2+
3+
on:
4+
push:
5+
tags:
6+
- "go-cli/v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: "1.21"
24+
cache-dependency-path: apps/go-cli/go.mod
25+
26+
- name: Resolve release version
27+
run: |
28+
TAG="${GITHUB_REF#refs/tags/}"
29+
VERSION="${TAG#go-cli/v}"
30+
echo "RELEASE_VERSION=${VERSION}" >> "$GITHUB_ENV"
31+
echo "Release tag: ${TAG}, version: ${VERSION}"
32+
33+
- name: Run GoReleaser
34+
uses: goreleaser/goreleaser-action@v6
35+
with:
36+
distribution: goreleaser
37+
version: "~> v2"
38+
args: release --clean --config .goreleaser.go-cli.yaml --skip=validate
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.go-cli.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: 2
2+
3+
project_name: deckops
4+
5+
builds:
6+
- id: deckops
7+
dir: apps/go-cli
8+
main: .
9+
binary: deckops
10+
env:
11+
- CGO_ENABLED=0
12+
goos:
13+
- darwin
14+
- linux
15+
- windows
16+
goarch:
17+
- amd64
18+
- arm64
19+
ldflags:
20+
- -s -w
21+
- -X=main.version={{ .Env.RELEASE_VERSION }}
22+
23+
archives:
24+
- formats:
25+
- tar.gz
26+
format_overrides:
27+
- goos: windows
28+
formats:
29+
- zip
30+
name_template: "{{ .ProjectName }}_{{ .Env.RELEASE_VERSION }}_{{ .Os }}_{{ .Arch }}"
31+
files:
32+
- apps/go-cli/README.md
33+
34+
checksum:
35+
name_template: checksums.txt
36+
37+
changelog:
38+
sort: asc
39+
filters:
40+
exclude:
41+
- '^docs:'
42+
- '^test:'
43+
- '^chore:'
44+
45+
release:
46+
github:
47+
owner: deckflow
48+
name: deckops
49+
name_template: "go-cli v{{ .Env.RELEASE_VERSION }}"

apps/go-cli/README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,34 @@
22

33
Go implementation of the Deckops CLI, using the local Go SDK in `sdks/go`.
44

5-
## Build
5+
## Install
6+
7+
Pre-built binaries are published on [GitHub Releases](https://github.com/deckflow/deckops/releases). Look for assets named `deckops_<version>_<os>_<arch>.tar.gz` (or `.zip` on Windows).
8+
9+
Example (macOS Apple Silicon):
10+
11+
```bash
12+
VERSION=0.7.0
13+
curl -fsSL "https://github.com/deckflow/deckops/releases/download/go-cli/v${VERSION}/deckops_${VERSION}_darwin_arm64.tar.gz" \
14+
| tar -xz
15+
sudo mv deckops /usr/local/bin/
16+
deckops --version
17+
```
18+
19+
Replace `darwin_arm64` with your platform:
20+
21+
| Platform | Asset suffix |
22+
|----------|--------------|
23+
| macOS (Apple Silicon) | `darwin_arm64` |
24+
| macOS (Intel) | `darwin_amd64` |
25+
| Linux (x64) | `linux_amd64` |
26+
| Linux (ARM64) | `linux_arm64` |
27+
| Windows (x64) | `windows_amd64.zip` |
28+
| Windows (ARM64) | `windows_arm64.zip` |
29+
30+
Verify downloads with the `checksums.txt` file attached to the same release.
31+
32+
## Build from source
633

734
```bash
835
go build -o deckops .
@@ -15,3 +42,14 @@ deckops [--json] <command> [options]
1542
```
1643

1744
The command surface mirrors `apps/node-cli`: `config`, `login`, `task`, `compress`, `extract`, `ocr`, `convert`, `join`, `create`, `translate`, and `run`.
45+
46+
## Release (maintainers)
47+
48+
Push a tag to trigger the GitHub Actions release workflow:
49+
50+
```bash
51+
git tag go-cli/v0.7.0
52+
git push origin go-cli/v0.7.0
53+
```
54+
55+
This builds macOS, Linux, and Windows binaries and uploads them to GitHub Releases.

apps/go-cli/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ import (
2323
)
2424

2525
const (
26-
version = "0.7.0"
26+
defaultVersion = "0.7.0"
2727
defaultTimeoutSec = 300
2828
defaultOCRLanguage = "zh-hans"
2929
defaultLoginPort = 3737
3030
loginTimeout = 5 * time.Minute
3131
)
3232

33+
var version = defaultVersion
34+
3335
var compressTypes = map[string]string{
3436
".zip": "file.compress",
3537
".pptx": "file.compress",

0 commit comments

Comments
 (0)