-
-
Notifications
You must be signed in to change notification settings - Fork 2
303 lines (239 loc) · 10.9 KB
/
release.yml
File metadata and controls
303 lines (239 loc) · 10.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
name: Release
on:
push:
tags:
- 'v*' # Trigger on version tags (v0.6.4, v1.0.0, etc.)
permissions:
contents: write
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history needed for changelog
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get version from tag
id: version
run: |
# Extract version from tag (v0.6.4 -> 0.6.4)
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Release version: $VERSION"
- name: Setup .NET 9
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'
- name: Install zip utility
run: sudo apt-get update && sudo apt-get install -y zip
- name: Generate changelog from commits
id: changelog
run: |
# Find previous version tag (not release trigger tags)
PREV_TAG=$(git describe --tags --abbrev=0 --match "v[0-9]*" HEAD^ 2>/dev/null || echo "")
echo "Previous tag: ${PREV_TAG:-none (first release)}"
if [ -z "$PREV_TAG" ]; then
# First release - get all commits (excluding automated commits)
COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges | grep -v "\[skip ci\]" | grep -v "Update CHANGELOG" | grep -v "Release v" | head -20)
else
# Get commits since last version tag (excluding automated commits)
COMMITS=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges | grep -v "\[skip ci\]" | grep -v "Update CHANGELOG" | grep -v "Release v")
fi
# Build changelog for GitHub release
{
echo "changelog<<EOF"
echo "## What's Changed"
echo ""
echo "$COMMITS"
if [ -n "$PREV_TAG" ]; then
echo ""
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...v${{ steps.version.outputs.version }}"
fi
echo "EOF"
} >> $GITHUB_OUTPUT
- name: Build all platforms
run: |
./build.sh
echo "✓ Built all platforms"
# ═══════════════════════════════════════════════════════════════
# NuGet Packages
# ═══════════════════════════════════════════════════════════════
- name: Build and push NuGet packages
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
VERSION=${{ steps.version.outputs.version }}
# Use simple release notes URL to avoid shell escaping issues with CHANGELOG content
RELEASE_NOTES="See https://github.com/${{ github.repository }}/releases/tag/v$VERSION for full release notes."
# Pack NuGet packages with release notes
dotnet pack LocalizationManager.JsonLocalization/LocalizationManager.JsonLocalization.csproj \
--configuration Release \
--output ./nupkg \
-p:PackageReleaseNotes="$RELEASE_NOTES"
dotnet pack LocalizationManager.JsonLocalization.Generator/LocalizationManager.JsonLocalization.Generator.csproj \
--configuration Release \
--output ./nupkg \
-p:PackageReleaseNotes="$RELEASE_NOTES"
echo "Generated NuGet packages:"
ls -la ./nupkg/*.nupkg
# Push to NuGet.org
for pkg in ./nupkg/*.nupkg; do
echo "Pushing $pkg..."
dotnet nuget push "$pkg" \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
done
echo "✓ NuGet packages published"
# ═══════════════════════════════════════════════════════════════
# VS Code Extension - Platform-Specific Builds
# ═══════════════════════════════════════════════════════════════
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install extension dependencies
run: |
cd vscode-extension
npm install
- name: Build platform-specific extensions
run: |
cd vscode-extension
npm run compile
# Package for each platform (each gets its own binary bundled)
for platform in win32-x64 win32-arm64 linux-x64 linux-arm64 darwin-x64 darwin-arm64; do
echo "══════════════════════════════════════════════════════"
echo "Packaging for $platform"
echo "══════════════════════════════════════════════════════"
# Bundle only this platform's binary
./scripts/bundle-binaries.sh --target $platform
# Package with platform target
npx vsce package --target $platform
done
echo ""
echo "Generated VSIX files:"
ls -la *.vsix
- name: Publish to VS Code Marketplace
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: |
cd vscode-extension
# Publish each platform-specific VSIX
for vsix in *.vsix; do
echo "Publishing $vsix..."
npx vsce publish --packagePath "$vsix" --pat "$VSCE_PAT"
done
echo "✓ All platform packages published to Marketplace"
- name: Install Debian packaging tools
run: |
sudo apt-get update
sudo apt-get install -y dpkg-dev debhelper devscripts dput-ng
- name: Build Debian packages (amd64)
run: |
./build-deb.sh amd64
echo "✓ Built amd64 .deb package (standalone)"
- name: Build Debian packages (arm64)
run: |
./build-deb.sh arm64
echo "✓ Built arm64 .deb package (standalone)"
- name: Build source package for PPA
run: |
./build-source-package.sh
echo "✓ Built source package"
- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
# Import GPG key
echo "$GPG_PRIVATE_KEY" | base64 -d | gpg --batch --import
# Configure GPG for non-interactive use
mkdir -p ~/.gnupg
chmod 700 ~/.gnupg
echo "use-agent" >> ~/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
# Restart GPG agent
gpg-connect-agent reloadagent /bye || true
echo "✓ GPG key imported and configured"
- name: Sign source package
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
LAUNCHPAD_EMAIL: ${{ secrets.LAUNCHPAD_EMAIL }}
run: |
cd publish/source
# Sign using debsign with passphrase from environment
# Use --no-conf to avoid user config interference
echo "$GPG_PASSPHRASE" | debsign --no-conf -k "$LAUNCHPAD_EMAIL" --no-re-sign -p"gpg --batch --pinentry-mode loopback --passphrase-fd 0" lrm_*_source.changes
echo "✓ Source package signed"
- name: Upload to Launchpad PPA
env:
LAUNCHPAD_EMAIL: ${{ secrets.LAUNCHPAD_EMAIL }}
run: |
cd publish/source
# Configure dput for PPA
cat > ~/.dput.cf << EOF
[lrm-tool-ppa]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~nickprotop/ubuntu/lrm-tool/
login = anonymous
allow_unsigned_uploads = 0
EOF
# Upload to PPA
dput lrm-tool-ppa lrm_*_source.changes
echo "✓ Uploaded to PPA: ppa:nickprotop/lrm-tool"
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.version }}
name: "Localization Resource Manager v${{ steps.version.outputs.version }}"
body: |
# LRM v${{ steps.version.outputs.version }}
${{ steps.changelog.outputs.changelog }}
## 📦 Downloads
### APT/PPA Installation (Recommended for Ubuntu/Debian)
```bash
sudo add-apt-repository ppa:nickprotop/lrm-tool
sudo apt update
sudo apt install lrm-standalone # Self-contained (~72MB)
```
### Direct Downloads
Choose the appropriate version for your platform:
**Linux (Direct Download):**
- **x64:** `lrm-linux-x64.tar.gz`
- **ARM64:** `lrm-linux-arm64.tar.gz` *(Raspberry Pi, etc.)*
**Linux (.deb packages):**
- **x64:** `lrm-standalone_${{ steps.version.outputs.version }}-1_amd64.deb` (~72MB)
- **ARM64:** `lrm-standalone_${{ steps.version.outputs.version }}-1_arm64.deb` (~72MB)
**macOS:**
- **x64 (Intel):** `lrm-osx-x64.tar.gz`
- **ARM64 (Apple Silicon):** `lrm-osx-arm64.tar.gz`
**Windows:**
- **x64:** `lrm-win-x64.zip`
- **ARM64:** `lrm-win-arm64.zip`
## 🧩 VS Code Extension
Install from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=nickprotop.localization-manager):
```
ext install nickprotop.localization-manager
```
The marketplace automatically provides the correct version for your platform.
Platform-specific VSIX files are also attached below for manual installation.
## 📖 Installation
See the [Installation Guide](https://github.com/${{ github.repository }}/blob/main/docs/INSTALLATION.md) for detailed instructions.
## 🧪 Verified
✅ All tests passing
files: |
publish/lrm-linux-x64.tar.gz
publish/lrm-linux-arm64.tar.gz
publish/lrm-osx-x64.tar.gz
publish/lrm-osx-arm64.tar.gz
publish/lrm-win-x64.zip
publish/lrm-win-arm64.zip
publish/deb/lrm-standalone_${{ steps.version.outputs.version }}-1_amd64.deb
publish/deb/lrm-standalone_${{ steps.version.outputs.version }}-1_arm64.deb
vscode-extension/*.vsix
draft: false
prerelease: false