Check for updates #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check for updates | |
on: | |
schedule: | |
- cron: "00 08 * * SUN" | |
workflow_dispatch: | |
env: | |
GIT_USER_NAME: github-actions[bot] | |
GIT_USER_EMAIL: github-actions[bot]@users.noreply.github.com | |
FLATPAK_ID: dev.opengoal.OpenGOAL | |
jobs: | |
flatpak-external-data-checker: | |
name: 'Check update' | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
ref: master | |
- uses: docker://ghcr.io/flathub/flatpak-external-data-checker:latest | |
with: | |
args: --edit-only ${{ env.FLATPAK_ID }}.yml | |
- name: Check updated | |
id: is-updated | |
run: | | |
git status -s -uno | |
[ -z "$(git status -s -uno)" ] || echo "::set-output name=updated::true" | |
- uses: actions/setup-python@v5 | |
if: steps.is-updated.outputs.updated | |
with: | |
python-version: 3.9 | |
- name: Install flatpak-node-generator and requirements | |
if: steps.is-updated.outputs.updated | |
run: | | |
python3 -m pip install pipx | |
python3 -m pip install pipreqs | |
pipreqs flatpak-builder-tools | |
python3 -m pip install -r flatpak-builder-tools/requirements.txt | |
cd flatpak-builder-tools/node && pipx install . | |
- name: Generate sources | |
if: steps.is-updated.outputs.updated | |
run: | | |
git submodule update --init | |
ver=$(grep release dev.opengoal.OpenGOAL.appdata.xml | grep -m1 -oP '(?<=version=.)[^"]+') | |
git clone --recursive -b "v${ver}" --depth=1 https://github.com/open-goal/launcher.git | |
flatpak-builder-tools/cargo/flatpak-cargo-generator.py -o cargo-sources.json launcher/src-tauri/Cargo.lock | |
flatpak-node-generator yarn launcher/yarn.lock | |
rm -rf launcher | |
- name: Reset | |
run: | | |
git checkout -- ${FLATPAK_ID}.yml *.xml | |
- uses: docker://ghcr.io/flathub/flatpak-external-data-checker:latest | |
name: Recheck and open PR | |
env: | |
GIT_AUTHOR_NAME: Flatpak External Data Checker | |
GIT_COMMITTER_NAME: Flatpak External Data Checker | |
GIT_AUTHOR_EMAIL: ${{ env.GIT_USER_NAME }} | |
GIT_COMMITTER_EMAIL: ${{ env.GIT_USER_EMAIL }} | |
EMAIL: ${{ env.GIT_USER_EMAIL }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: --update --never-fork ${{ env.FLATPAK_ID }}.yml |