Skip to content

Commit 38f0fb0

Browse files
committed
refactor: update release scripts and improve installation instructions
1 parent c8ea198 commit 38f0fb0

File tree

3 files changed

+223
-36
lines changed

3 files changed

+223
-36
lines changed

.goreleaser.yml

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,14 @@ release:
100100
101101
### Installation
102102
103-
#### Homebrew (macOS/Linux)
104-
```bash
105-
brew install SharanRP/tap/gh-notif
106-
```
107-
108-
#### Scoop (Windows)
109-
```powershell
110-
scoop bucket add SharanRP https://github.com/SharanRP/scoop-bucket
111-
scoop install gh-notif
112-
```
113-
114103
#### Direct Download
115104
Download the appropriate binary for your platform from the assets below.
116105
106+
#### Package Managers
107+
- **Debian/Ubuntu**: Download the `.deb` file and install with `sudo dpkg -i gh-notif_*.deb`
108+
- **Red Hat/CentOS/Fedora**: Download the `.rpm` file and install with `sudo rpm -i gh-notif-*.rpm`
109+
- **Alpine Linux**: Download the `.apk` file and install with `sudo apk add --allow-untrusted gh-notif_*.apk`
110+
117111
footer: |
118112
**Full Changelog**: https://github.com/SharanRP/gh-notif/compare/{{ .PreviousTag }}...{{ .Tag }}
119113
@@ -124,31 +118,31 @@ release:
124118
docker pull ghcr.io/sharanrp/gh-notif:latest
125119
```
126120
127-
brews:
128-
- name: gh-notif
129-
repository:
130-
owner: "{{ .Env.GITHUB_REPOSITORY_OWNER }}"
131-
name: homebrew-tap
132-
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
133-
folder: Formula
134-
homepage: https://github.com/SharanRP/gh-notif
135-
description: "A high-performance CLI tool for managing GitHub notifications"
136-
license: MIT
137-
test: |
138-
system "#{bin}/gh-notif --version"
139-
install: |
140-
bin.install "gh-notif"
141-
man1.install Dir["docs/man/*.1"]
142-
143-
scoops:
144-
- name: gh-notif
145-
repository:
146-
owner: "{{ .Env.GITHUB_REPOSITORY_OWNER }}"
147-
name: scoop-bucket
148-
token: "{{ .Env.SCOOP_BUCKET_GITHUB_TOKEN }}"
149-
homepage: https://github.com/SharanRP/gh-notif
150-
description: "A high-performance CLI tool for managing GitHub notifications"
151-
license: MIT
121+
# brews:
122+
# - name: gh-notif
123+
# repository:
124+
# owner: "{{ .Env.GITHUB_REPOSITORY_OWNER }}"
125+
# name: homebrew-tap
126+
# token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
127+
# folder: Formula
128+
# homepage: https://github.com/SharanRP/gh-notif
129+
# description: "A high-performance CLI tool for managing GitHub notifications"
130+
# license: MIT
131+
# test: |
132+
# system "#{bin}/gh-notif --version"
133+
# install: |
134+
# bin.install "gh-notif"
135+
# man1.install Dir["docs/man/*.1"]
136+
137+
# scoops:
138+
# - name: gh-notif
139+
# repository:
140+
# owner: "{{ .Env.GITHUB_REPOSITORY_OWNER }}"
141+
# name: scoop-bucket
142+
# token: "{{ .Env.SCOOP_BUCKET_GITHUB_TOKEN }}"
143+
# homepage: https://github.com/SharanRP/gh-notif
144+
# description: "A high-performance CLI tool for managing GitHub notifications"
145+
# license: MIT
152146

153147
nfpms:
154148
- id: packages

scripts/test-release.ps1

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Local Release Testing Script
2+
# This script tests the release process locally before pushing to GitHub
3+
4+
Write-Host "Testing gh-notif release process locally..." -ForegroundColor Green
5+
6+
# Check if GoReleaser is installed
7+
if (!(Get-Command goreleaser -ErrorAction SilentlyContinue)) {
8+
Write-Host "[ERROR] GoReleaser not found. Please install it first:" -ForegroundColor Red
9+
Write-Host " scoop install goreleaser" -ForegroundColor Yellow
10+
Write-Host " Or download from: https://github.com/goreleaser/goreleaser/releases" -ForegroundColor Yellow
11+
exit 1
12+
}
13+
14+
Write-Host "[OK] GoReleaser found" -ForegroundColor Green
15+
16+
# Clean previous builds
17+
Write-Host "[INFO] Cleaning previous builds..." -ForegroundColor Blue
18+
if (Test-Path "dist") {
19+
Remove-Item -Recurse -Force "dist"
20+
}
21+
22+
# Test GoReleaser configuration
23+
Write-Host "[INFO] Checking GoReleaser configuration..." -ForegroundColor Blue
24+
goreleaser check
25+
if ($LASTEXITCODE -ne 0) {
26+
Write-Host "[ERROR] GoReleaser configuration check failed!" -ForegroundColor Red
27+
exit 1
28+
}
29+
Write-Host "[OK] GoReleaser configuration is valid" -ForegroundColor Green
30+
31+
# Test build process
32+
Write-Host "[INFO] Testing build process..." -ForegroundColor Blue
33+
goreleaser build --snapshot --clean
34+
if ($LASTEXITCODE -ne 0) {
35+
Write-Host "[ERROR] Build failed!" -ForegroundColor Red
36+
exit 1
37+
}
38+
Write-Host "[OK] Build successful" -ForegroundColor Green
39+
40+
# List generated files
41+
Write-Host "[INFO] Generated files:" -ForegroundColor Blue
42+
if (Test-Path "dist") {
43+
Get-ChildItem -Recurse "dist" | Select-Object Name, Length | Format-Table
44+
}
45+
46+
# Test Docker build (if Docker is available)
47+
if (Get-Command docker -ErrorAction SilentlyContinue) {
48+
Write-Host "[INFO] Testing Docker build..." -ForegroundColor Blue
49+
50+
# Copy a binary to test Docker build
51+
$linuxBinary = Get-ChildItem "dist" -Recurse -Filter "*linux_amd64*" | Where-Object { $_.Name -eq "gh-notif" } | Select-Object -First 1
52+
if ($linuxBinary) {
53+
Copy-Item $linuxBinary.FullName "gh-notif"
54+
docker build -t gh-notif-test .
55+
if ($LASTEXITCODE -eq 0) {
56+
Write-Host "[OK] Docker build successful" -ForegroundColor Green
57+
58+
# Test running the Docker image
59+
Write-Host "[INFO] Testing Docker image..." -ForegroundColor Blue
60+
docker run --rm gh-notif-test version
61+
62+
# Clean up
63+
Remove-Item "gh-notif" -ErrorAction SilentlyContinue
64+
} else {
65+
Write-Host "[ERROR] Docker build failed!" -ForegroundColor Red
66+
}
67+
} else {
68+
Write-Host "[WARN] No Linux binary found for Docker test" -ForegroundColor Yellow
69+
}
70+
} else {
71+
Write-Host "[WARN] Docker not found, skipping Docker build test" -ForegroundColor Yellow
72+
}
73+
74+
# Test full release process (without publishing)
75+
Write-Host "[INFO] Testing full release process (dry run)..." -ForegroundColor Blue
76+
goreleaser release --snapshot --clean
77+
if ($LASTEXITCODE -ne 0) {
78+
Write-Host "[ERROR] Release process failed!" -ForegroundColor Red
79+
exit 1
80+
}
81+
Write-Host "[OK] Release process successful" -ForegroundColor Green
82+
83+
# Show summary
84+
Write-Host "`n[SUMMARY] Test Summary:" -ForegroundColor Cyan
85+
Write-Host "[OK] GoReleaser configuration valid" -ForegroundColor Green
86+
Write-Host "[OK] Build process working" -ForegroundColor Green
87+
Write-Host "[OK] Release process working" -ForegroundColor Green
88+
89+
if (Test-Path "dist") {
90+
$fileCount = (Get-ChildItem -Recurse "dist").Count
91+
Write-Host "[INFO] Generated $fileCount files in dist/" -ForegroundColor Blue
92+
}
93+
94+
Write-Host "`n[SUCCESS] All tests passed! Ready to push to GitHub." -ForegroundColor Green
95+
Write-Host "[INFO] To create a release, run:" -ForegroundColor Yellow
96+
Write-Host " git tag v1.0.6" -ForegroundColor White
97+
Write-Host " git push origin v1.0.6" -ForegroundColor White

scripts/test-release.sh

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/bin/bash
2+
# Local Release Testing Script
3+
# This script tests the release process locally before pushing to GitHub
4+
5+
set -e
6+
7+
echo "🧪 Testing gh-notif release process locally..."
8+
9+
# Check if GoReleaser is installed
10+
if ! command -v goreleaser &> /dev/null; then
11+
echo "❌ GoReleaser not found. Please install it first:"
12+
echo " brew install goreleaser/tap/goreleaser"
13+
echo " Or download from: https://github.com/goreleaser/goreleaser/releases"
14+
exit 1
15+
fi
16+
17+
echo "✅ GoReleaser found"
18+
19+
# Clean previous builds
20+
echo "🧹 Cleaning previous builds..."
21+
rm -rf dist/
22+
23+
# Test GoReleaser configuration
24+
echo "🔍 Checking GoReleaser configuration..."
25+
if ! goreleaser check; then
26+
echo "❌ GoReleaser configuration check failed!"
27+
exit 1
28+
fi
29+
echo "✅ GoReleaser configuration is valid"
30+
31+
# Test build process
32+
echo "🔨 Testing build process..."
33+
if ! goreleaser build --snapshot --clean; then
34+
echo "❌ Build failed!"
35+
exit 1
36+
fi
37+
echo "✅ Build successful"
38+
39+
# List generated files
40+
echo "📦 Generated files:"
41+
if [ -d "dist" ]; then
42+
find dist -type f -exec ls -lh {} \; | head -20
43+
fi
44+
45+
# Test Docker build (if Docker is available)
46+
if command -v docker &> /dev/null; then
47+
echo "🐳 Testing Docker build..."
48+
49+
# Copy a binary to test Docker build
50+
linux_binary=$(find dist -name "gh-notif" -path "*linux_amd64*" | head -1)
51+
if [ -n "$linux_binary" ]; then
52+
cp "$linux_binary" gh-notif
53+
if docker build -t gh-notif-test .; then
54+
echo "✅ Docker build successful"
55+
56+
# Test running the Docker image
57+
echo "🧪 Testing Docker image..."
58+
docker run --rm gh-notif-test version
59+
60+
# Clean up
61+
rm -f gh-notif
62+
else
63+
echo "❌ Docker build failed!"
64+
fi
65+
else
66+
echo "⚠️ No Linux binary found for Docker test"
67+
fi
68+
else
69+
echo "⚠️ Docker not found, skipping Docker build test"
70+
fi
71+
72+
# Test full release process (without publishing)
73+
echo "🚀 Testing full release process (dry run)..."
74+
if ! goreleaser release --snapshot --clean; then
75+
echo "❌ Release process failed!"
76+
exit 1
77+
fi
78+
echo "✅ Release process successful"
79+
80+
# Show summary
81+
echo ""
82+
echo "📋 Test Summary:"
83+
echo "✅ GoReleaser configuration valid"
84+
echo "✅ Build process working"
85+
echo "✅ Release process working"
86+
87+
if [ -d "dist" ]; then
88+
file_count=$(find dist -type f | wc -l)
89+
echo "📦 Generated $file_count files in dist/"
90+
fi
91+
92+
echo ""
93+
echo "🎉 All tests passed! Ready to push to GitHub."
94+
echo "💡 To create a release, run:"
95+
echo " git tag v1.0.6"
96+
echo " git push origin v1.0.6"

0 commit comments

Comments
 (0)