-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (150 loc) · 6.28 KB
/
flatpak.yml
File metadata and controls
167 lines (150 loc) · 6.28 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
name: Build Flatpak
on:
release:
types: [published]
workflow_dispatch:
inputs:
releaseId:
type: string
required: true
description: Release ID to attach the Flatpak bundle to
permissions: {}
jobs:
build:
strategy:
matrix:
arch: [x86_64, aarch64]
include:
- arch: x86_64
runner: ubuntu-latest
zip-arch: x64
- arch: aarch64
runner: ubuntu-24.04-arm
zip-arch: arm64
runs-on: ${{ matrix.runner }}
permissions:
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
- name: Get release info
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
if [ "${{ github.event_name }}" = "release" ]; then
tag="${{ github.event.release.tag_name }}"
release_id="${{ github.event.release.id }}"
else
tag="$(gh api repos/${{ github.repository }}/releases/${{ inputs.releaseId }} --jq '.tag_name')"
release_id="${{ inputs.releaseId }}"
fi
version="${tag#v}"
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "release_id=${release_id}" >> "$GITHUB_OUTPUT"
- name: Install Flatpak and flatpak-builder
shell: bash
run: |
sudo apt-get update
sudo apt-get -y install flatpak flatpak-builder
- name: Add Flathub remote and install SDK
shell: bash
run: |
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y flathub \
org.freedesktop.Platform//24.08 \
org.freedesktop.Sdk//24.08 \
org.electronjs.Electron2.BaseApp//24.08
- name: Download release ZIP and prepare manifest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.release.outputs.version }}
TAG: ${{ steps.release.outputs.tag }}
shell: bash
run: |
set -o pipefail
cd flatpak
gh release download "${TAG}" \
-R ${{ github.repository }} \
-p "*-linux-${{ matrix.zip-arch }}-portable.zip"
zip_file="$(ls *-linux-${{ matrix.zip-arch }}-portable.zip)"
zip_hash="$(sha256sum "$zip_file" | awk '{print $1}')"
cp ../_icons/icon.svg .
icon_hash="$(sha256sum icon.svg | awk '{print $1}')"
# Generate a JSON build manifest with local file paths (flatpak-builder accepts JSON)
python3 -c "
import json, sys
manifest = {
'app-id': 'io.github.countgitmick.FreeTubePlusTabs',
'runtime': 'org.freedesktop.Platform',
'runtime-version': '24.08',
'sdk': 'org.freedesktop.Sdk',
'base': 'org.electronjs.Electron2.BaseApp',
'base-version': '24.08',
'command': 'run.sh',
'separate-locales': False,
'finish-args': [
'--device=dri', '--share=ipc', '--share=network',
'--socket=x11', '--socket=wayland', '--socket=pulseaudio',
'--filesystem=xdg-download',
'--own-name=org.mpris.MediaPlayer2.chromium.*',
'--own-name=org.mpris.MediaPlayer2.freetube',
'--talk-name=org.freedesktop.Notifications',
'--talk-name=org.freedesktop.PowerManagement',
'--talk-name=org.freedesktop.ScreenSaver',
'--talk-name=org.gnome.SessionManager',
'--talk-name=org.gnome.SettingsDaemon',
'--talk-name=org.kde.StatusNotifierWatcher',
],
'modules': [{
'name': 'freetube-plus-tabs',
'buildsystem': 'simple',
'sources': [
{'type': 'file', 'path': sys.argv[1], 'sha256': sys.argv[2]},
{'type': 'file', 'path': 'icon.svg', 'sha256': sys.argv[3]},
{'type': 'file', 'path': 'run.sh'},
{'type': 'file', 'path': 'io.github.countgitmick.FreeTubePlusTabs.desktop'},
{'type': 'file', 'path': 'io.github.countgitmick.FreeTubePlusTabs.metainfo.xml'},
],
'build-commands': [
'install -d /app/lib/freetube-plus-tabs',
'bsdtar -xf freetube-plus-tabs-*.zip -C /app/lib/freetube-plus-tabs',
'install -Dm755 run.sh /app/bin/run.sh',
'install -Dm644 icon.svg /app/share/icons/hicolor/scalable/apps/io.github.countgitmick.FreeTubePlusTabs.svg',
'install -Dm644 io.github.countgitmick.FreeTubePlusTabs.desktop -t /app/share/applications/',
'install -Dm644 io.github.countgitmick.FreeTubePlusTabs.metainfo.xml -t /app/share/metainfo/',
'patch-desktop-filename \"\${FLATPAK_DEST}\"/lib/freetube-plus-tabs/resources/app.asar',
],
}],
}
with open('build-manifest.json', 'w') as f:
json.dump(manifest, f, indent=2)
" "$zip_file" "$zip_hash" "$icon_hash"
- name: Build Flatpak
shell: bash
run: |
cd flatpak
flatpak-builder --force-clean --repo=repo build-dir build-manifest.json
- name: Create Flatpak bundle
env:
VERSION: ${{ steps.release.outputs.version }}
shell: bash
run: |
cd flatpak
flatpak build-bundle repo \
"freetube-plus-tabs-${VERSION}-linux-${{ matrix.arch }}.flatpak" \
io.github.countgitmick.FreeTubePlusTabs
- name: Upload Flatpak bundle to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.release.outputs.version }}
RELEASE_ID: ${{ steps.release.outputs.release_id }}
shell: bash
run: |
gh api "https://uploads.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets?name=freetube-plus-tabs-${VERSION}-beta-linux-${{ matrix.arch }}.flatpak" \
--method POST \
-H "Content-Type: application/octet-stream" \
--input "flatpak/freetube-plus-tabs-${VERSION}-linux-${{ matrix.arch }}.flatpak"