-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease-github-profile-tools.yml
More file actions
223 lines (192 loc) · 9 KB
/
release-github-profile-tools.yml
File metadata and controls
223 lines (192 loc) · 9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Release GitHub Profile Tools
on:
push:
tags:
- 'v*' # Trigger on version tags like v1.0.0, v1.1.0, etc.
permissions:
contents: write # Required to create releases and upload assets
jobs:
build-and-release:
name: Build and Release Cross-Platform Binaries
runs-on: ubuntu-latest
strategy:
matrix:
# Define build targets for cross-compilation
include:
- goos: windows
goarch: amd64
binary_name: github-user-analyzer-windows-amd64.exe
compress_format: zip
- goos: linux
goarch: amd64
binary_name: github-user-analyzer-linux-amd64
compress_format: tar.gz
- goos: linux
goarch: arm64
binary_name: github-user-analyzer-linux-arm64
compress_format: tar.gz
- goos: darwin
goarch: amd64
binary_name: github-user-analyzer-darwin-amd64
compress_format: tar.gz
- goos: darwin
goarch: arm64
binary_name: github-user-analyzer-darwin-arm64
compress_format: tar.gz
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for changelog generation
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21' # Use Go 1.21 for compatibility
check-latest: true
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create dist directory
run: mkdir -p dist
- name: Build binary
working-directory: ./github-profile-tools
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
# Build with version information embedded
go build \
-ldflags="-X main.version=${{ steps.version.outputs.VERSION }} -X main.buildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) -s -w" \
-o ../dist/${{ matrix.binary_name }} \
./cmd/github-user-analyzer
- name: Run basic smoke test (native architecture only)
if: matrix.goos == 'linux' && matrix.goarch == 'amd64'
working-directory: ./dist
run: |
chmod +x ${{ matrix.binary_name }}
# Test version flag - should not require network or tokens
timeout 10s ./${{ matrix.binary_name }} -version
- name: Create distribution package
working-directory: ./dist
run: |
# Create package directory
mkdir -p github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}
# Copy binary
cp ${{ matrix.binary_name }} github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}/
# Copy documentation with proper error handling
if [ -f ../github-profile-tools/README.md ]; then
cp ../github-profile-tools/README.md github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}/
else
echo "::warning::README.md not found, skipping"
fi
if [ -f ../github-profile-tools/LICENSE ]; then
cp ../github-profile-tools/LICENSE github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}/
else
echo "::warning::LICENSE not found, skipping"
fi
# Create appropriate archive
if [ "${{ matrix.compress_format }}" = "zip" ]; then
zip -r github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.zip \
github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}/
ARCHIVE_NAME="github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.zip"
else
tar -czf github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz \
github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}/
ARCHIVE_NAME="github-profile-tools-${{ steps.version.outputs.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz"
fi
# Generate checksum
sha256sum "$ARCHIVE_NAME" > "$ARCHIVE_NAME.sha256"
echo "ARCHIVE_NAME=$ARCHIVE_NAME" >> $GITHUB_ENV
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: github-profile-tools-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
dist/${{ env.ARCHIVE_NAME }}
dist/${{ env.ARCHIVE_NAME }}.sha256
retention-days: 30
create-release:
name: Create GitHub Release
needs: build-and-release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-assets/
- name: Organize release assets
run: |
# Flatten artifact directory structure
find release-assets/ -name "*.tar.gz" -o -name "*.zip" -o -name "*.sha256" | \
xargs -I {} mv {} release-assets/
# Clean up empty directories
find release-assets/ -type d -empty -delete
# List final assets
echo "Release assets:"
ls -la release-assets/
- name: Generate changelog
id: changelog
run: |
# Generate changelog from git history since last tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
if [ -n "$PREVIOUS_TAG" ]; then
echo "## Changes since $PREVIOUS_TAG" > CHANGELOG.md
echo "" >> CHANGELOG.md
git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD -- github-profile-tools/ >> CHANGELOG.md
else
echo "## Initial Release" > CHANGELOG.md
echo "" >> CHANGELOG.md
echo "First release of GitHub Profile Tools with the following features:" >> CHANGELOG.md
echo "- Comprehensive GitHub profile analysis" >> CHANGELOG.md
echo "- Multiple template formats (resume, technical, executive, ats)" >> CHANGELOG.md
echo "- Efficient caching and rate limit handling" >> CHANGELOG.md
echo "- Cross-platform binary support" >> CHANGELOG.md
fi
echo "## Download" >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "Choose the appropriate binary for your platform:" >> CHANGELOG.md
echo "- **Windows (x64)**: \`github-profile-tools-${{ steps.version.outputs.VERSION }}-windows-amd64.zip\`" >> CHANGELOG.md
echo "- **Linux (x64)**: \`github-profile-tools-${{ steps.version.outputs.VERSION }}-linux-amd64.tar.gz\`" >> CHANGELOG.md
echo "- **Linux (ARM64)**: \`github-profile-tools-${{ steps.version.outputs.VERSION }}-linux-arm64.tar.gz\`" >> CHANGELOG.md
echo "- **macOS (Intel)**: \`github-profile-tools-${{ steps.version.outputs.VERSION }}-darwin-amd64.tar.gz\`" >> CHANGELOG.md
echo "- **macOS (Apple Silicon)**: \`github-profile-tools-${{ steps.version.outputs.VERSION }}-darwin-arm64.tar.gz\`" >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "All downloads include SHA256 checksums for verification." >> CHANGELOG.md
# Output for GitHub release
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
cat CHANGELOG.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: GitHub Profile Tools ${{ steps.version.outputs.VERSION }}
body: ${{ steps.changelog.outputs.CHANGELOG }}
files: release-assets/*
draft: false
prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }} # Mark as prerelease if tag contains hyphen (e.g., v1.0.0-beta)
generate_release_notes: true # Auto-generate additional release notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update latest release info
run: |
echo "✅ Released GitHub Profile Tools ${{ steps.version.outputs.VERSION }}"
echo "📦 Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.VERSION }}"
echo "📥 Download page: https://github.com/${{ github.repository }}/releases/latest"