This repository has been archived by the owner on Aug 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
186 lines (157 loc) · 5.94 KB
/
flatpak.yml
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
name: Flatpak
on: [push]
env:
FLATPAK_ID: com.valvesoftware.Steam.CompatibilityTool.Proton
IMAGE_NAME: proton
IMAGE_TAG: latest
DOCKERHUB_USER: ${{ github.repository_owner }}
DOCKERHUB_REPO: ${{ github.repository_owner }}/proton-flatpak
FP_BUNDLE: proton-flatpak-${{ github.run_id }}
FP_BRANCH: stable
FP_BUILD_DIR: build-dir
FP_BUILD_REPO: build-repo
FLAT_MANAGER_URL: https://flatpak.russianfedora.online
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install flatpak-builder
run: |
set -e
sudo add-apt-repository -y ppa:alexlarsson/flatpak
sudo apt update -y
sudo apt install -y flatpak-builder
- name: Dump canonical manifest
run: |
set -e
flatpak-builder --show-manifest ${FLATPAK_ID}.yml > canonical-manifest.json
- name: Download flatpak SDK and sources
run: |
set -e
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak-builder --install-deps-from=flathub --install-deps-only --user /dev/null ${FLATPAK_ID}.yml
flatpak-builder --download-only /dev/null ${FLATPAK_ID}.yml
- name: Prime cache
uses: actions/cache@v2
with:
path: |
.flatpak-builder/ccache
key: flatpak-builder-${{ hashFiles('canonical-manifest.json') }}
restore-keys: |
flatpak-builder-
- name: Build flatpak
run: |
set -e
flatpak-builder --disable-updates --disable-download --ccache --sandbox --repo=${FP_BUILD_REPO} ${FP_BUILD_DIR} ${FLATPAK_ID}.yml
- name: Mark as EOL
run: |
set -e
flatpak build-commit-from -v \
--end-of-life='Migrated to Flathub' \
${FP_BUILD_REPO} \
--src-ref=runtime/${FLATPAK_ID}/x86_64/${FP_BRANCH} \
runtime/${FLATPAK_ID}/x86_64/${FP_BRANCH}
- name: Upload flatpak repo
uses: actions/upload-artifact@v1
with:
name: ${{ env.FP_BUILD_REPO }}
path: ${{ env.FP_BUILD_REPO }}
publish-bundle:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Install flatpak
run: |
set -e
sudo add-apt-repository -y ppa:alexlarsson/flatpak
sudo apt update -y
sudo apt install -y flatpak
- name: Download flatpak repo
uses: actions/download-artifact@v1
with:
name: ${{ env.FP_BUILD_REPO }}
- name: Create flatpak bundle
run: |
set -e
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo --runtime ${FP_BUILD_REPO} ${FP_BUNDLE}.flatpak ${FLATPAK_ID} ${FP_BRANCH}
- name: Upload flatpak bundle
uses: actions/upload-artifact@v1
with:
name: ${{ env.FP_BUNDLE }}
path: ${{ env.FP_BUNDLE }}.flatpak
publish-ostree:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Install flat-manager-client
run: |
set -e
sudo apt update -y
sudo apt install -y python3-pip python3-setuptools python3-gi gir1.2-glib-2.0 gir1.2-ostree-1.0 wget
sudo pip3 install aiohttp tenacity
wget https://github.com/flatpak/flat-manager/raw/0.3.7/flat-manager-client
chmod +x ./flat-manager-client
- name: Download flatpak repo
uses: actions/download-artifact@v1
with:
name: ${{ env.FP_BUILD_REPO }}
- name: Push flatpak repo
env:
REPO_TOKEN: ${{ secrets.FLATPAK_REPO_TOKEN }}
#XXX empty directories are lost, but libostree needs them
run: |
set -e
mkdir -p ${FP_BUILD_REPO}/{extensions,refs/{mirrors,remotes},state,tmp/cache}
BUILD_URL="$(./flat-manager-client create "${FLAT_MANAGER_URL}" "${FP_BRANCH}")"
./flat-manager-client push --commit --publish --wait --wait-update "${BUILD_URL}" "${FP_BUILD_REPO}"
publish-oci:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Install flatpak and libcontainers tools
run: |
set -e
. /etc/os-release
sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key | sudo apt-key add -
sudo add-apt-repository -y ppa:alexlarsson/flatpak
sudo apt update -y
sudo apt install -y skopeo flatpak jq
- name: Download flatpak repo
uses: actions/download-artifact@v1
with:
name: ${{ env.FP_BUILD_REPO }}
- name: Create OCI bundle
run: |
set -e
flatpak build-bundle \
--oci \
--runtime-repo=https://flathub.org/repo/flathub.flatpakrepo \
--runtime \
${FP_BUILD_REPO} ${FP_BUNDLE} ${FLATPAK_ID} ${FP_BRANCH}
- name: Publish OCI image
run: |
set -e
skopeo copy \
--dest-creds ${DOCKERHUB_USER}:${{ secrets.DOCKERHUB_TOKEN }} \
oci:${FP_BUNDLE} \
docker://docker.io/$DOCKERHUB_REPO:$IMAGE_TAG
- name: Update static index
run: |
set -e
git clone -b gh-pages https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git gh-pages
skopeo inspect docker://docker.io/$DOCKERHUB_REPO:$IMAGE_TAG | \
jq '. as $img | { "Registry": "https://registry-1.docker.io/", "Results": [ { "Name": "'$DOCKERHUB_REPO'", "Images": [$img] } ] }' \
> gh-pages/index/static
cd gh-pages
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config user.name "Workflow trigger"
git add index/static
git commit -m "Update index for ${GITHUB_SHA:0:7}"
git push