Skip to content

Commit 638159b

Browse files
committed
Add CI/CD workflows and improve distribution
- Add release.yml: automated releases via GoReleaser on tag push - Add ci.yml: build, test, lint on PRs with GoReleaser validation - Auto-publish releases (no draft), add install footer to releases - Create gpc symlink in Homebrew formula and install script - Ignore built binaries in .gitignore
1 parent 2238f86 commit 638159b

5 files changed

Lines changed: 139 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
build:
11+
name: Build & Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version: '1.21'
21+
cache: true
22+
23+
- name: Download dependencies
24+
run: go mod download
25+
26+
- name: Build
27+
run: go build -v ./...
28+
29+
- name: Test
30+
run: go test -v ./...
31+
32+
lint:
33+
name: Lint
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Set up Go
40+
uses: actions/setup-go@v5
41+
with:
42+
go-version: '1.21'
43+
cache: true
44+
45+
- name: golangci-lint
46+
uses: golangci/golangci-lint-action@v4
47+
with:
48+
version: latest
49+
args: --timeout=5m
50+
continue-on-error: true
51+
52+
validate-goreleaser:
53+
name: Validate GoReleaser
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 0
60+
61+
- name: Set up Go
62+
uses: actions/setup-go@v5
63+
with:
64+
go-version: '1.21'
65+
cache: true
66+
67+
- name: Check GoReleaser config
68+
uses: goreleaser/goreleaser-action@v6
69+
with:
70+
distribution: goreleaser
71+
version: latest
72+
args: check

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: '1.21'
25+
cache: true
26+
27+
- name: Run tests
28+
run: go test -v ./...
29+
30+
- name: Run GoReleaser
31+
uses: goreleaser/goreleaser-action@v6
32+
with:
33+
distribution: goreleaser
34+
version: latest
35+
args: release --clean
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
39+
40+
notify:
41+
name: Notify
42+
needs: release
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Release notification
46+
run: |
47+
echo "🚀 Released ${{ github.ref_name }}"
48+
echo "View at: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Binaries
22
bin/
33
dist/
4+
playconsole-cli
5+
gpc
46
*.exe
57
*.exe~
68
*.dll

.goreleaser.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ brews:
6464
repository:
6565
owner: AndroidPoet
6666
name: homebrew-tap
67+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
6768
homepage: https://github.com/AndroidPoet/playconsole-cli
6869
description: "Fast, lightweight, and scriptable CLI for Google Play Console"
6970
license: MIT
7071
install: |
7172
bin.install "playconsole-cli"
73+
bin.install_symlink "playconsole-cli" => "gpc"
7274
test: |
73-
system "#{bin}/playconsole-cli", "version"
75+
system "#{bin}/gpc", "version"
7476
7577
nfpms:
7678
- id: packages
@@ -87,5 +89,14 @@ release:
8789
github:
8890
owner: AndroidPoet
8991
name: playconsole-cli
90-
draft: true
92+
draft: false
9193
prerelease: auto
94+
footer: |
95+
## Installation
96+
```bash
97+
brew tap AndroidPoet/tap && brew install playconsole-cli
98+
```
99+
Or use the install script:
100+
```bash
101+
curl -fsSL https://raw.githubusercontent.com/AndroidPoet/playconsole-cli/main/install.sh | bash
102+
```

install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ fi
120120

121121
chmod +x "$INSTALL_DIR/playconsole-cli"
122122

123+
# Create gpc alias
124+
ln -sf "$INSTALL_DIR/playconsole-cli" "$INSTALL_DIR/gpc"
125+
123126
info "Installed playconsole-cli to $INSTALL_DIR/playconsole-cli"
127+
info "Created alias: gpc -> playconsole-cli"
124128

125129
# Check PATH
126130
if ! echo "$PATH" | tr ':' '\n' | grep -q "^$INSTALL_DIR$"; then

0 commit comments

Comments
 (0)