Skip to content

Commit b7571b0

Browse files
committed
feat: Add auto-update documentation workflow
- Create INSTALL.md with comprehensive installation guide - Add GitHub Actions workflow to auto-update docs on release - Support 4 platforms: macOS ARM/Intel, Linux ARM/AMD64 - Auto-updates version numbers and download links - Triggered on release publish or manual dispatch
1 parent d842752 commit b7571b0

File tree

2 files changed

+308
-0
lines changed

2 files changed

+308
-0
lines changed

.github/workflows/update-docs.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Update Documentation
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to update to (e.g., v1.0.1)'
10+
required: true
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
update-docs:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Get version
25+
id: version
26+
run: |
27+
if [ "${{ github.event_name }}" = "release" ]; then
28+
VERSION="${{ github.event.release.tag_name }}"
29+
else
30+
VERSION="${{ github.event.inputs.version }}"
31+
fi
32+
33+
# Remove 'v' prefix if present
34+
VERSION_NUMBER="${VERSION#v}"
35+
36+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
37+
echo "version_number=${VERSION_NUMBER}" >> $GITHUB_OUTPUT
38+
echo "Updating to version: ${VERSION}"
39+
40+
- name: Update INSTALL.md
41+
run: |
42+
VERSION="${{ steps.version.outputs.version }}"
43+
VERSION_NUMBER="${{ steps.version.outputs.version_number }}"
44+
45+
# Update version in download links
46+
sed -i "s|v[0-9]\+\.[0-9]\+\.[0-9]\+|${VERSION}|g" INSTALL.md
47+
sed -i "s|dev-cleaner_[0-9]\+\.[0-9]\+\.[0-9]\+|dev-cleaner_${VERSION_NUMBER}|g" INSTALL.md
48+
49+
# Update "Latest Release" header
50+
sed -i "s|Latest Release: v[0-9]\+\.[0-9]\+\.[0-9]\+|Latest Release: ${VERSION}|" INSTALL.md
51+
52+
# Update last updated date
53+
sed -i "s|Last updated:.*|Last updated: $(date +%Y-%m-%d)|" INSTALL.md
54+
55+
# Update expected version output
56+
sed -i "s|dev-cleaner version [0-9]\+\.[0-9]\+\.[0-9]\+|dev-cleaner version ${VERSION_NUMBER}|g" INSTALL.md
57+
58+
- name: Update README.md
59+
run: |
60+
VERSION="${{ steps.version.outputs.version }}"
61+
VERSION_NUMBER="${{ steps.version.outputs.version_number }}"
62+
63+
# Update Homebrew section - remove "Coming Soon"
64+
sed -i 's|### Homebrew (Coming Soon)|### Homebrew (Recommended)|' README.md
65+
66+
# Add version badge if not exists
67+
if ! grep -q "Version" README.md; then
68+
sed -i '/\[!\[License\]/a [![Version](https://img.shields.io/badge/Version-'${VERSION_NUMBER}'-blue?style=flat-square)](https://github.com/thanhdevapp/mac-dev-cleaner-cli/releases/latest)' README.md
69+
else
70+
# Update existing version badge
71+
sed -i "s|Version-[0-9]\+\.[0-9]\+\.[0-9]\+|Version-${VERSION_NUMBER}|" README.md
72+
fi
73+
74+
# Update build instructions to use correct path
75+
sed -i 's|go build -o dev-cleaner \.|go build -o dev-cleaner ./cmd/dev-cleaner|' README.md
76+
77+
# Add direct download section if not exists
78+
if ! grep -q "Direct Download" README.md; then
79+
# Add after Homebrew section
80+
sed -i '/brew install dev-cleaner/a \\n### Direct Download\n\nDownload pre-built binaries: [INSTALL.md](INSTALL.md)' README.md
81+
fi
82+
83+
- name: Check for changes
84+
id: check_changes
85+
run: |
86+
if git diff --quiet INSTALL.md README.md; then
87+
echo "has_changes=false" >> $GITHUB_OUTPUT
88+
echo "No changes detected"
89+
else
90+
echo "has_changes=true" >> $GITHUB_OUTPUT
91+
echo "Changes detected:"
92+
git diff INSTALL.md README.md
93+
fi
94+
95+
- name: Commit and push
96+
if: steps.check_changes.outputs.has_changes == 'true'
97+
run: |
98+
VERSION="${{ steps.version.outputs.version }}"
99+
100+
git config --local user.email "[email protected]"
101+
git config --local user.name "goreleaserbot"
102+
103+
git add INSTALL.md README.md
104+
git commit -m "docs: Update installation docs to ${VERSION}"
105+
git push
106+
107+
- name: Summary
108+
run: |
109+
VERSION="${{ steps.version.outputs.version }}"
110+
echo "## Documentation Update Complete" >> $GITHUB_STEP_SUMMARY
111+
echo "" >> $GITHUB_STEP_SUMMARY
112+
echo "Updated to version: **${VERSION}**" >> $GITHUB_STEP_SUMMARY
113+
echo "" >> $GITHUB_STEP_SUMMARY
114+
115+
if [ "${{ steps.check_changes.outputs.has_changes }}" = "true" ]; then
116+
echo "✅ INSTALL.md and README.md updated" >> $GITHUB_STEP_SUMMARY
117+
else
118+
echo "ℹ️ No changes needed" >> $GITHUB_STEP_SUMMARY
119+
fi

INSTALL.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
<!-- AUTO-GENERATED - DO NOT EDIT MANUALLY -->
2+
<!-- This file is automatically updated by .github/workflows/update-docs.yml -->
3+
<!-- Last updated: 2025-12-17 -->
4+
5+
# Installation Guide
6+
7+
## Quick Install
8+
9+
### macOS (Homebrew) - Recommended
10+
11+
```bash
12+
# Add tap
13+
brew tap thanhdevapp/tools
14+
15+
# Install
16+
brew install dev-cleaner
17+
18+
# Verify
19+
dev-cleaner --version
20+
```
21+
22+
**Update to latest version:**
23+
```bash
24+
brew update
25+
brew upgrade dev-cleaner
26+
```
27+
28+
---
29+
30+
## Download Binaries
31+
32+
### Latest Release: v1.0.1
33+
34+
#### macOS
35+
36+
**Apple Silicon (M1/M2/M3)**
37+
```bash
38+
# Download
39+
curl -L https://github.com/thanhdevapp/mac-dev-cleaner-cli/releases/download/v1.0.1/dev-cleaner_1.0.1_darwin_arm64.tar.gz -o dev-cleaner.tar.gz
40+
41+
# Extract
42+
tar -xzf dev-cleaner.tar.gz
43+
44+
# Install to PATH
45+
sudo mv dev-cleaner /usr/local/bin/
46+
47+
# Verify
48+
dev-cleaner --version
49+
```
50+
51+
**Intel**
52+
```bash
53+
# Download
54+
curl -L https://github.com/thanhdevapp/mac-dev-cleaner-cli/releases/download/v1.0.1/dev-cleaner_1.0.1_darwin_amd64.tar.gz -o dev-cleaner.tar.gz
55+
56+
# Extract
57+
tar -xzf dev-cleaner.tar.gz
58+
59+
# Install to PATH
60+
sudo mv dev-cleaner /usr/local/bin/
61+
62+
# Verify
63+
dev-cleaner --version
64+
```
65+
66+
#### Linux
67+
68+
**ARM64**
69+
```bash
70+
curl -L https://github.com/thanhdevapp/mac-dev-cleaner-cli/releases/download/v1.0.1/dev-cleaner_1.0.1_linux_arm64.tar.gz -o dev-cleaner.tar.gz
71+
tar -xzf dev-cleaner.tar.gz
72+
sudo mv dev-cleaner /usr/local/bin/
73+
dev-cleaner --version
74+
```
75+
76+
**AMD64**
77+
```bash
78+
curl -L https://github.com/thanhdevapp/mac-dev-cleaner-cli/releases/download/v1.0.1/dev-cleaner_1.0.1_linux_amd64.tar.gz -o dev-cleaner.tar.gz
79+
tar -xzf dev-cleaner.tar.gz
80+
sudo mv dev-cleaner /usr/local/bin/
81+
dev-cleaner --version
82+
```
83+
84+
---
85+
86+
## Build from Source
87+
88+
### Prerequisites
89+
- Go 1.21 or higher
90+
- Git
91+
92+
### Steps
93+
94+
```bash
95+
# Clone repository
96+
git clone https://github.com/thanhdevapp/mac-dev-cleaner-cli.git
97+
cd mac-dev-cleaner-cli
98+
99+
# Build CLI
100+
go build -o dev-cleaner ./cmd/dev-cleaner
101+
102+
# Install to PATH
103+
sudo mv dev-cleaner /usr/local/bin/
104+
105+
# Verify
106+
dev-cleaner --version
107+
```
108+
109+
### Build GUI (Wails)
110+
111+
```bash
112+
# Install dependencies
113+
cd frontend
114+
npm install
115+
npm run build
116+
cd ..
117+
118+
# Build GUI app
119+
wails build
120+
121+
# Run
122+
./build/bin/Mac\ Dev\ Cleaner.app/Contents/MacOS/Mac\ Dev\ Cleaner
123+
```
124+
125+
---
126+
127+
## Verify Installation
128+
129+
After installation, verify the tool works:
130+
131+
```bash
132+
# Check version
133+
dev-cleaner --version
134+
# Expected output: dev-cleaner version 1.0.1
135+
136+
# Run help
137+
dev-cleaner --help
138+
139+
# Test scan (dry-run)
140+
dev-cleaner scan --help
141+
```
142+
143+
---
144+
145+
## All Releases
146+
147+
View all releases: [GitHub Releases](https://github.com/thanhdevapp/mac-dev-cleaner-cli/releases)
148+
149+
---
150+
151+
## Uninstall
152+
153+
### Homebrew
154+
```bash
155+
brew uninstall dev-cleaner
156+
brew untap thanhdevapp/tools
157+
```
158+
159+
### Manual Install
160+
```bash
161+
sudo rm /usr/local/bin/dev-cleaner
162+
rm ~/.dev-cleaner.log # Optional: remove log file
163+
```
164+
165+
---
166+
167+
## Troubleshooting
168+
169+
### "command not found: dev-cleaner"
170+
- Check if `/usr/local/bin` is in your PATH
171+
- Try: `echo $PATH | grep /usr/local/bin`
172+
- Add to PATH if needed: `export PATH="/usr/local/bin:$PATH"`
173+
174+
### "permission denied"
175+
- Run with sudo: `sudo mv dev-cleaner /usr/local/bin/`
176+
- Or install to user directory: `mv dev-cleaner ~/bin/`
177+
178+
### Homebrew: "Xcode version outdated"
179+
- This is a warning, not an error
180+
- Installation still works
181+
- Alternatively, use direct download method
182+
183+
---
184+
185+
## Support
186+
187+
- **Issues**: [GitHub Issues](https://github.com/thanhdevapp/mac-dev-cleaner-cli/issues)
188+
- **Documentation**: [README.md](README.md)
189+
- **Releases**: [GitHub Releases](https://github.com/thanhdevapp/mac-dev-cleaner-cli/releases)

0 commit comments

Comments
 (0)