-
Notifications
You must be signed in to change notification settings - Fork 1
169 lines (142 loc) · 5.54 KB
/
deploy-linux.yml
File metadata and controls
169 lines (142 loc) · 5.54 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
name: Deploy — Linux
on:
push:
tags:
- "v*"
env:
BINARY_NAME: git-tree
jobs:
test:
uses: ./.github/workflows/test.yml
build:
needs: test
uses: ./.github/workflows/build-linux.yml
# ── 3. Package — raw binary + AppImage ────────────────────────────────────
package:
name: Package Linux
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libgit2-dev \
fuse3 \
libxdo3 \
pkg-config
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact-name }}
path: dist/
- name: Rename binary
run: |
VERSION="${{ github.ref_name }}"
mv dist/${{ env.BINARY_NAME }} dist/${{ env.BINARY_NAME }}-linux-x86_64
chmod +x dist/${{ env.BINARY_NAME }}-linux-x86_64
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
# ── AppImage ────────────────────────────────────────────────────────────
- name: Download linuxdeploy + GTK plugin
run: |
wget -O linuxdeploy-x86_64.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
# wget -O linuxdeploy-plugin-gtk.AppImage https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/releases/download/continuous/linuxdeploy-plugin-gtk-x86_64.AppImage
- name: Create AppDir structure
run: |
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
# Binary
cp dist/${{ env.BINARY_NAME }}-linux-x86_64 AppDir/usr/bin/${{ env.BINARY_NAME }}
cp assets/icon/icon.svg AppDir/git-tree.svg
# Icon — convert SVG to PNG if needed
sudo apt-get install -y librsvg2-bin
rsvg-convert -w 256 -h 256 assets/icon/icon.svg \
> AppDir/usr/share/icons/hicolor/256x256/apps/${{ env.BINARY_NAME }}.png
# .desktop file
cat > AppDir/${{ env.BINARY_NAME }}.desktop << EOF
[Desktop Entry]
Name=git-tree
Comment=Terminal-style git branch visualizer
Exec=git-tree
Icon=git-tree
Terminal=false
Type=Application
Categories=Development;
EOF
- name: Build AppImage
env:
DEPLOY_GTK_VERSION: 3
run: |
./linuxdeploy-x86_64.AppImage \
--appdir AppDir \
-e AppDir/usr/bin/${{ env.BINARY_NAME }} \
-d AppDir/${{ env.BINARY_NAME }}.desktop \
-i AppDir/usr/share/icons/hicolor/256x256/apps/${{ env.BINARY_NAME }}.png \
--output appimage
APPIMAGE=$(find . -name "*.AppImage" | grep -v linuxdeploy | head -1)
mv "$APPIMAGE" dist/${{ env.BINARY_NAME }}-${{ env.VERSION }}-x86_64.AppImage
- name: Compute SHA256
run: |
cd dist
sha256sum ${{ env.BINARY_NAME }}-linux-x86_64 \
${{ env.BINARY_NAME }}-${{ env.VERSION }}-x86_64.AppImage \
> SHA256SUMS-linux.txt
- name: Upload packaged artifacts
uses: actions/upload-artifact@v4
with:
name: linux-packaged-${{ github.ref_name }}
path: dist/
retention-days: 7
# ── 4. GitHub Release ──────────────────────────────────────────────────────
release:
name: GitHub Release (Linux)
needs: [build, package]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download packaged artifacts
uses: actions/download-artifact@v4
with:
name: linux-packaged-${{ github.ref_name }}
path: dist/
- name: Build release notes
run: |
VERSION=${{ github.ref_name }}
if [ -f CHANGELOG.md ]; then
awk "/^## \[?${VERSION#v}\]?/{found=1; next} found && /^## /{exit} found{print}" \
CHANGELOG.md > release_notes.txt
fi
if [ ! -s release_notes.txt ]; then
cat > release_notes.txt << 'EOF'
## Linux Installation
### AppImage (recommended — no install needed)
```bash
chmod +x git-tree-*-x86_64.AppImage
./git-tree-*-x86_64.AppImage
```
### Raw binary
```bash
chmod +x git-tree-linux-x86_64
./git-tree-linux-x86_64
```
**System deps for raw binary:**
`libgit2` `webkit2gtk-4.1` `gtk3` `libxdo`
EOF
fi
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
name: "git-tree ${{ github.ref_name }}"
body_path: release_notes.txt
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
files: |
dist/${{ env.BINARY_NAME }}-linux-x86_64
dist/${{ env.BINARY_NAME }}-${{ github.ref_name }}-x86_64.AppImage
dist/SHA256SUMS-linux.txt