-
Notifications
You must be signed in to change notification settings - Fork 117
148 lines (129 loc) · 4.71 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
name: Flatpak Packages
on:
push:
branches:
- main
- "releases/**"
pull_request:
branches:
- main
- "releases/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
manifest:
name: "Generate Manifest"
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
sparse-checkout: linux/flatpak/
- name: Install pip tools
shell: bash
run: pip install PyYAML yq
- name: Update git reference
shell: bash
working-directory: linux/flatpak
run: |
python -m yq -yi 'del(.modules[-1].sources[0].branch)' org.mozilla.vpn.yml
python -m yq -yi ".modules[-1].sources[0].url = \"https://github.com/${{ github.repository }}\"" org.mozilla.vpn.yml
python -m yq -yi ".modules[-1].sources[0].commit = \"${{ github.sha }}\"" org.mozilla.vpn.yml
cat org.mozilla.vpn.yml
- name: Add Appstream metainfo
shell: bash
working-directory: linux/flatpak
run: |
curl -sSL -o org.mozilla.vpn.releases.xml \
https://mozilla.github.io/mozillavpn-product-details/org.mozilla.vpn.releases.xml
python -m yq -yi '.modules += ["mozillavpn-appstream.yaml"]' org.mozilla.vpn.yml
- name: Upload manifest
uses: actions/upload-artifact@v4
with:
name: mozillavpn-manifest
path: linux/flatpak
linter:
name: "Linters"
runs-on: ubuntu-latest
needs:
- manifest
steps:
- name: Download manifest
uses: actions/download-artifact@v4
with:
name: mozillavpn-manifest
path: manifest/
- name: Install Flatpak Linting Tools
shell: bash
run: |
sudo apt-get update
sudo apt-get install flatpak flatpak-builder -y
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user flathub -y org.flatpak.Builder
- name: Run Manifest Linters
shell: bash
run: flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest manifest/org.mozilla.vpn.yml
- name: Run Appstream Linters
shell: bash
run: flatpak run --command=flatpak-builder-lint org.flatpak.Builder appstream manifest/org.mozilla.vpn.metainfo.xml
build:
name: "Build"
runs-on: ubuntu-latest
needs:
- manifest
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:kde-6.6
options: --privileged
steps:
- name: Download manifest
uses: actions/download-artifact@v4
with:
name: mozillavpn-manifest
path: manifest/
- name: Build
uses: flathub-infra/flatpak-github-actions/flatpak-builder@master
with:
bundle: mozillavpn.flatpak
manifest-path: manifest/org.mozilla.vpn.yml
cache-key: flatpak-builder-${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.sha }}
dependabot-cargo:
name: "Update Crates"
runs-on: ubuntu-latest
if: |
startsWith(github.head_ref, 'dependabot/cargo/') &&
github.actor == 'dependabot[bot]' &&
github.event_name == 'pull_request'
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.DEPENDABOT_TOKEN }}
- name: Install pip tools
shell: bash
run: pip install requirements-parser PyYAML toml aiohttp
# Do not continue if there are changes to the flatpak directory.
- name: Inspect pull request
id: inspect
shell: bash
run: |
git fetch origin "${{ github.base_ref }}" --depth=1
echo -n "flatpak-changes=" >> $GITHUB_OUTPUT
git diff --name-only --relative=linux/flatpak "origin/${{ github.base_ref }}" | wc -l >> $GITHUB_OUTPUT
- name: Update flatpak rust crates
shell: bash
if: ${{ steps.inspect.outputs.flatpak-changes == 0 }}
run: ./linux/flatpak/flatpak-update-crates.sh ./Cargo.lock
- name: Commit the changes
shell: bash
if: ${{ steps.inspect.outputs.flatpak-changes == 0 }}
run: |
if git diff --name-only | grep -q '^linux/flatpak/flatpak-vpn-crates.json'; then
git add linux/flatpak/flatpak-vpn-crates.json
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git commit -m "[dependabot skip] Update linux/flatpak/flatpak-vpn-crates.json"
git format-patch --stdout HEAD~1
git push
fi