-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.57 KB
/
update-flathub.yml
File metadata and controls
76 lines (65 loc) · 2.57 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
# SPDX-FileCopyrightText: 2026 Arcangelo Massari <info@arcangelomassari.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Update Flathub
on:
workflow_run:
workflows: ["Verify Flatpak"]
types:
- completed
branches:
- main
workflow_dispatch:
jobs:
update-flathub:
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout astrogods-app
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: main
- name: Get version from manifest
id: version
run: |
VERSION=$(grep -oP 'tag: \K[0-9]+\.[0-9]+\.[0-9]+' it.astrogods.AstroGods.yml | head -1)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Clone Flathub repo
run: |
git clone https://x-access-token:${{ secrets.FLATHUB_TOKEN }}@github.com/flathub/it.astrogods.AstroGods.git flathub-repo
- name: Check if update needed
id: check
run: |
FLATHUB_VERSION=$(grep -oP 'tag: \K[0-9]+\.[0-9]+\.[0-9]+' flathub-repo/it.astrogods.AstroGods.yml | head -1)
if [ "$FLATHUB_VERSION" = "${{ steps.version.outputs.version }}" ]; then
echo "skip=true" >> $GITHUB_OUTPUT
echo "Flathub already at version ${{ steps.version.outputs.version }}"
else
echo "skip=false" >> $GITHUB_OUTPUT
echo "Updating Flathub from $FLATHUB_VERSION to ${{ steps.version.outputs.version }}"
fi
- name: Copy generated files
if: steps.check.outputs.skip == 'false'
run: |
cp it.astrogods.AstroGods.yml flathub-repo/
cp -r generated flathub-repo/
- name: Create PR on Flathub
if: steps.check.outputs.skip == 'false'
env:
GH_TOKEN: ${{ secrets.FLATHUB_TOKEN }}
run: |
cd flathub-repo
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
BRANCH="update-${{ steps.version.outputs.version }}"
git checkout -b "$BRANCH"
git add -A
git commit -m "chore: update to ${{ steps.version.outputs.version }}"
git push origin "$BRANCH"
gh pr create \
--title "chore: update to ${{ steps.version.outputs.version }}" \
--body "Automated update from [astrogods-app](https://github.com/arcangelo7/astrogods-app)." \
--head "$BRANCH" \
--base master