-
Notifications
You must be signed in to change notification settings - Fork 140
62 lines (52 loc) · 2.15 KB
/
update-flatpak-docs.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
name: Update Flatpak docs
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch: {}
jobs:
archive:
name: Update Flatpak docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt install -y appstream git libxml2-utils
- name: Download docs
run: |
curl -L -o flatpak-docs.pkg.tar.zst https://archlinux.org/packages/extra/x86_64/flatpak-docs/download/
tar --zstd -xf flatpak-docs.pkg.tar.zst
- name: Get current docs version
run: |
old_flatpak_version="$(xmllint --html --xpath "//p[@class='releaseinfo']/text()" docs/flatpak-docs.html|sed "s/Version//g"|awk '{$1=$1};1')"
echo "OLD_FLATPAK_VERSION=${old_flatpak_version}" >> $GITHUB_ENV
- name: Move docs
run: |
cp -vf usr/share/doc/flatpak/flatpak-docs.html docs/
- name: Get new docs version
run: |
new_flatpak_version="$(xmllint --html --xpath "//p[@class='releaseinfo']/text()" docs/flatpak-docs.html|sed "s/Version//g"|awk '{$1=$1};1')"
echo "NEW_FLATPAK_VERSION=${new_flatpak_version}" >> $GITHUB_ENV
- name: Compare versions
id: vercomp
run: |
appstreamcli vercmp $NEW_FLATPAK_VERSION gt $OLD_FLATPAK_VERSION
continue-on-error: true
- name: Update failed
if: ${{ steps.vercomp.outcome == 'failure' }}
run: echo "Docs version was same or no update was found in the previous step"
- name: Create pull request
if: ${{ success() && steps.vercomp.outcome == 'success' }}
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch-suffix: "random"
commit-message: |
(Automated) Update Flatpak docs
Update Flatpak docs from ${{env.OLD_FLATPAK_VERSION}} to ${{env.NEW_FLATPAK_VERSION}}
title: "(Automated) Update Flatpak docs"
body: |
Update Flatpak docs from ${{env.OLD_FLATPAK_VERSION}} to ${{env.NEW_FLATPAK_VERSION}}
delete-branch: true
sign-commits: true
draft: always-true