-
-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (186 loc) · 6.62 KB
/
release-linux.yml
File metadata and controls
212 lines (186 loc) · 6.62 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
name: Release (Linux)
on:
workflow_call:
inputs:
version:
required: true
type: string
workflow_dispatch:
inputs:
version:
description: "Version to use (e.g. 2.1.0). Defaults to 2.0.0-dev"
required: false
default: "2.0.0-dev"
permissions:
contents: read
jobs:
build-linux:
runs-on: ubuntu-22.04
timeout-minutes: 45
name: Build Linux (AppImage, deb, rpm)
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
- name: Resolve version
id: get_version
run: |
VERSION="${{ inputs.version }}"
IS_PRERELEASE="false"
if [[ "$VERSION" == *-* ]]; then
IS_PRERELEASE="true"
fi
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
echo "IS_PRERELEASE=$IS_PRERELEASE" >> "$GITHUB_OUTPUT"
echo "Version: $VERSION PreRelease: $IS_PRERELEASE"
- uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: Cache pub dependencies
uses: actions/cache@v5
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: ${{ runner.os }}-pub-
- name: Install Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
clang \
cmake \
desktop-file-utils \
libayatana-appindicator3-dev \
libfuse2 \
libgtk-3-dev \
libkeybinder-3.0-dev \
liblzma-dev \
libx11-dev \
libxtst-dev \
lld-14 \
ninja-build \
patchelf \
pkg-config \
rpm
- name: Verify Linux toolchain preflight
run: |
set -euo pipefail
test -x /usr/lib/llvm-14/bin/ld.lld || test -x /usr/bin/ld.lld-14 || test -x /usr/bin/ld.lld
pkg-config --modversion gtk+-3.0
pkg-config --modversion keybinder-3.0
pkg-config --modversion ayatana-appindicator3-0.1
pkg-config --modversion x11
pkg-config --modversion xtst
- name: Install Fastforge
run: dart pub global activate fastforge
- name: Install appimagetool
run: |
wget -qO /usr/local/bin/appimagetool \
"https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod +x /usr/local/bin/appimagetool
- name: Install Melos
run: dart pub global activate melos
- name: Get dependencies
run: melos bootstrap
- name: Update pubspec version from tag
run: |
VERSION="${{ steps.get_version.outputs.VERSION }}"
sed -i "s/^version:.*/version: $VERSION/" app/pubspec.yaml
echo "Updated pubspec.yaml version to: $VERSION"
- name: Package AppImage
env:
APPIMAGE_EXTRACT_AND_RUN: "1"
run: |
cd app
fastforge package \
--platform linux \
--targets appimage \
--build-dart-define "APP_VERSION=${{ steps.get_version.outputs.VERSION }}"
- name: Rename AppImage
run: |
VERSION="${{ steps.get_version.outputs.VERSION }}"
APPIMAGE=$(find app/dist app/build -type f -name "*.AppImage" 2>/dev/null | head -n 1)
if [[ -z "$APPIMAGE" ]]; then
echo "::error::No AppImage generated"
exit 1
fi
mkdir -p app/dist
DEST="app/dist/CopyPaste_${VERSION}_x86_64.AppImage"
mv "$APPIMAGE" "$DEST"
chmod +x "$DEST"
echo "Renamed to: $(basename "$DEST")"
- name: Package deb
run: |
cd app
fastforge package \
--platform linux \
--targets deb \
--build-dart-define "APP_VERSION=${{ steps.get_version.outputs.VERSION }}" \
--skip-clean
- name: Rename deb
run: |
VERSION="${{ steps.get_version.outputs.VERSION }}"
DEB=$(find app/dist app/build -type f -name "*.deb" 2>/dev/null | head -n 1)
if [[ -z "$DEB" ]]; then
echo "::error::No deb package generated"
exit 1
fi
mkdir -p app/dist
DEST="app/dist/CopyPaste_${VERSION}_amd64.deb"
mv "$DEB" "$DEST"
echo "Renamed to: $(basename "$DEST")"
- name: Normalize version for RPM
id: rpm_version
run: |
VERSION="${{ steps.get_version.outputs.VERSION }}"
RPM_VERSION="${VERSION%%-*}"
echo "RPM_VERSION=$RPM_VERSION" >> "$GITHUB_OUTPUT"
echo "RPM version (normalized): $RPM_VERSION"
- name: Package rpm
run: |
RPM_VERSION="${{ steps.rpm_version.outputs.RPM_VERSION }}"
cd app
sed -i "s/^version:.*/version: $RPM_VERSION/" pubspec.yaml
fastforge package \
--platform linux \
--targets rpm \
--build-dart-define "APP_VERSION=${{ steps.get_version.outputs.VERSION }}" \
--skip-clean
VERSION="${{ steps.get_version.outputs.VERSION }}"
sed -i "s/^version:.*/version: $VERSION/" pubspec.yaml
- name: Rename rpm
run: |
VERSION="${{ steps.get_version.outputs.VERSION }}"
RPM=$(find app/dist app/build -type f -name "*.rpm" 2>/dev/null | head -n 1)
if [[ -z "$RPM" ]]; then
echo "::error::No rpm package generated"
exit 1
fi
mkdir -p app/dist
DEST="app/dist/CopyPaste_${VERSION}_x86_64.rpm"
mv "$RPM" "$DEST"
echo "Renamed to: $(basename "$DEST")"
- name: Publish deb to Cloudsmith
if: github.event_name == 'push'
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
run: |
pip install cloudsmith-cli
cloudsmith push deb rgdevment/copypaste/any-distro/any-version \
app/dist/CopyPaste_${{ steps.get_version.outputs.VERSION }}_amd64.deb --republish
- name: Publish rpm to Cloudsmith
if: github.event_name == 'push'
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
run: |
cloudsmith push rpm rgdevment/copypaste/any-distro/any-version \
app/dist/CopyPaste_${{ steps.get_version.outputs.VERSION }}_x86_64.rpm --republish
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: release-linux
path: |
app/dist/*.AppImage
app/dist/*.deb
app/dist/*.rpm
retention-days: 5