From eb4d3db2a48b88fa657a834b3c1a4f68413a35ee Mon Sep 17 00:00:00 2001 From: bbhtt Date: Thu, 5 Sep 2024 20:55:38 +0530 Subject: [PATCH] ci: Setup scheduled action to update Flatpak docs --- .../workflows/update-flatpak-builder-docs.yml | 51 +++++++++++++++++++ .github/workflows/update-flatpak-docs.yml | 51 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 .github/workflows/update-flatpak-builder-docs.yml create mode 100644 .github/workflows/update-flatpak-docs.yml diff --git a/.github/workflows/update-flatpak-builder-docs.yml b/.github/workflows/update-flatpak-builder-docs.yml new file mode 100644 index 00000000..b0e1da35 --- /dev/null +++ b/.github/workflows/update-flatpak-builder-docs.yml @@ -0,0 +1,51 @@ +name: Update Flatpak Builder docs + +on: + schedule: + - cron: '0 0 1 * *' + workflow_dispatch: {} + +jobs: + archive: + name: Update Flatpak Builder docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + sudo add-apt-repository ppa:flatpak/development + sudo apt update + sudo apt install -y flatpak flatpak-builder git libxml2-utils + + - name: Get current docs version + run: | + old_flatpak_builder_version="$(xmllint --html --xpath "//p[@class='releaseinfo']/text()" docs/flatpak-builder-docs.html|sed "s/Version//g"|awk '{$1=$1};1')" + echo "OLD_FLATPAK_BUILDER_VERSION=${old_flatpak_builder_version}" >> $GITHUB_ENV + + - name: Move docs + run: | + cp -vf /usr/share/doc/flatpak-builder/flatpak-builder-docs.html docs/ + + - name: Get new docs version + run: | + new_flatpak_builder_version="$(xmllint --html --xpath "//p[@class='releaseinfo']/text()" docs/flatpak-builder-docs.html|sed "s/Version//g"|awk '{$1=$1};1')" + echo "NEW_FLATPAK_BUILDER_VERSION=${new_flatpak_builder_version}" >> $GITHUB_ENV + + - name: Compare versions + run: | + appstreamcli vercmp $NEW_FLATPAK_BUILDER_VERSION gt $OLD_FLATPAK_BUILDER_VERSION + + - name: Create pull request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch-suffix: "short-commit-hash" + commit-message: | + (Automated) Update Flatpak Builder docs + + Update Flatpak Builder docs from ${{env.OLD_FLATPAK_BUILDER_VERSION}} to ${{env.NEW_FLATPAK_BUILDER_VERSION}} + title: "(Automated) Update Flatpak Builder docs" + body: | + Update Flatpak Builder docs from ${{env.OLD_FLATPAK_BUILDER_VERSION}} to ${{env.NEW_FLATPAK_BUILDER_VERSION}} + delete-branch: true + sign-commits: true diff --git a/.github/workflows/update-flatpak-docs.yml b/.github/workflows/update-flatpak-docs.yml new file mode 100644 index 00000000..626370b7 --- /dev/null +++ b/.github/workflows/update-flatpak-docs.yml @@ -0,0 +1,51 @@ +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 add-apt-repository ppa:flatpak/development + sudo apt update + sudo apt install -y flatpak flatpak-builder git libxml2-utils + + - 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 + run: | + appstreamcli vercmp $NEW_FLATPAK_VERSION gt $OLD_FLATPAK_VERSION + + - name: Create pull request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch-suffix: "short-commit-hash" + 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