-
Notifications
You must be signed in to change notification settings - Fork 2
259 lines (215 loc) · 8.24 KB
/
Copy pathrelease.yml
File metadata and controls
259 lines (215 loc) · 8.24 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
name: Release Build
on:
push:
branches:
- master
paths-ignore:
- '**.md'
- '.gitignore'
workflow_dispatch:
jobs:
check-release:
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.check.outputs.should_release }}
version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for [release] in commit message
id: check
run: |
COMMIT_MSG=$(git log -1 --pretty=%B)
if echo "$COMMIT_MSG" | grep -q "\[release\]"; then
echo "should_release=true" >> $GITHUB_OUTPUT
# Extract version from package.json
VERSION=$(grep -oP '"version":\s*"\K[^"]+' package.json)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Release triggered with version $VERSION"
else
echo "should_release=false" >> $GITHUB_OUTPUT
echo "No [release] tag found in commit message"
fi
# build-deb:
# needs: check-release
# if: needs.check-release.outputs.should_release == 'true'
# runs-on: ubuntu-22.04
# steps:
# - name: "🧹 Nuclear Disk Cleanup"
# run: |
# echo "Disk space BEFORE cleanup:"
# df -h
# # 1. Remove large frameworks we don't use
# sudo rm -rf /usr/share/dotnet
# sudo rm -rf /usr/local/lib/android
# sudo rm -rf /opt/ghc
# sudo rm -rf /opt/hostedtoolcache/CodeQL
# sudo rm -rf /usr/share/swift
# # 2. Remove Docker images (take up a lot of space)
# sudo docker image prune --all --force
# # 3. Clean apt cached packages
# sudo apt-get clean
# # 4. Remove Tool Cache (old Node, Python, Ruby versions)
# # NOTE: If you use setup-node or setup-python later, they will re-download
# # but only the version you need, not all of them.
# sudo rm -rf /opt/hostedtoolcache
# # 5. Remove Swap (optional, frees ~4GB but may affect if you have low RAM)
# # sudo swapoff -a
# # sudo rm -f /mnt/swapfile
# echo "Disk space AFTER cleanup:"
# df -h
# - uses: actions/checkout@v4
# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '20'
# - name: Install Rust
# uses: dtolnay/rust-toolchain@stable
# - name: Install system dependencies
# run: |
# sudo apt-get update
# sudo apt-get install -y \
# libwebkit2gtk-4.1-dev \
# build-essential \
# curl \
# wget \
# file \
# libxdo-dev \
# libssl-dev \
# libayatana-appindicator3-dev \
# librsvg2-dev
# - name: Install dependencies
# run: npm install
# - name: Build Tauri .deb
# run: npm run tauri build -- --bundles deb
# - name: Rename .deb file
# run: |
# VERSION="${{ needs.check-release.outputs.version }}"
# DEB_FILE=$(find src-tauri/target/release/bundle/deb -name "*.deb" -type f)
# mv "$DEB_FILE" "Klia-Store-${VERSION}.deb"
# - name: Upload .deb artifact
# uses: actions/upload-artifact@v4
# with:
# name: deb-package
# path: Klia-Store-*.deb
build-flatpak:
needs: check-release
if: needs.check-release.outputs.should_release == 'true'
runs-on: ubuntu-22.04
steps:
- name: "🧹 Nuclear Disk Cleanup"
run: |
echo "Disk space BEFORE cleanup:"
df -h
# 1. Remove large frameworks we don't use
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/share/swift
# 2. Remove Docker images (take up a lot of space)
sudo docker image prune --all --force
# 3. Clean apt cached packages
sudo apt-get clean
# 4. Remove Tool Cache (old Node, Python, Ruby versions)
# NOTE: If you use setup-node or setup-python later, they will re-download
# but only the version you need, not all of them.
sudo rm -rf /opt/hostedtoolcache
# 5. Remove Swap (optional, frees ~4GB but may affect if you have low RAM)
# sudo swapoff -a
# sudo rm -f /mnt/swapfile
echo "Disk space AFTER cleanup:"
df -h
- uses: actions/checkout@v4
- name: Install Flatpak and dependencies
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder
- name: Add Flathub repository
run: |
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Install GNOME SDK
run: |
sudo flatpak install -y flathub org.gnome.Platform//49 org.gnome.Sdk//49
- name: Build Flatpak
run: |
flatpak-builder --repo=repo --force-clean build-dir io.github.N3kosempai.klia-store.yml
flatpak build-bundle repo Klia-Store-${{ needs.check-release.outputs.version }}.flatpak io.github.N3kosempai.klia-store
- name: Upload Flatpak artifact
uses: actions/upload-artifact@v4
with:
name: flatpak-package
path: Klia-Store-*.flatpak
create-release:
needs: [check-release, build-flatpak]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
# - name: Download .deb artifact
# uses: actions/download-artifact@v4
# with:
# name: deb-package
- name: Download Flatpak artifact
uses: actions/download-artifact@v4
with:
name: flatpak-package
- name: Extract release notes from metainfo
id: extract_notes
run: |
VERSION="${{ needs.check-release.outputs.version }}"
# Extract the description for the current version from metainfo.xml
NOTES=$(python3 << 'EOF'
import xml.etree.ElementTree as ET
import sys
try:
tree = ET.parse('io.github.N3kosempai.klia-store.metainfo.xml')
root = tree.getroot()
version = "${{ needs.check-release.outputs.version }}"
# Find the release with matching version
for release in root.findall('.//release'):
if release.get('version') == version:
desc = release.find('description')
if desc is not None:
# Extract text content from description
lines = []
for elem in desc.iter():
if elem.text and elem.text.strip():
lines.append(elem.text.strip())
if elem.tail and elem.tail.strip():
lines.append(elem.tail.strip())
print('\n'.join(lines))
break
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
EOF
)
# If extraction fails, use commit message as fallback
if [ -z "$NOTES" ]; then
NOTES="${{ github.event.head_commit.message }}"
fi
# Save to output (handle multiline)
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.check-release.outputs.version }}
name: Klia Store ${{ needs.check-release.outputs.version }}
draft: false
prerelease: false
body: |
## Klia Store ${{ needs.check-release.outputs.version }}
### What's New
${{ steps.extract_notes.outputs.notes }}
### Installation
**Flatpak:**
```bash
flatpak install Klia-Store-${{ needs.check-release.outputs.version }}.flatpak
flatpak run io.github.N3kosempai.klia-store
```
files: |
Klia-Store-*.flatpak