Auto-update #149
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: Auto-update | |
on: | |
schedule: | |
- cron: "30 19 * * 1" # Run every Monday on 19:30 UTC | |
workflow_dispatch: | |
env: | |
GIT_USER_NAME: github-actions[bot] | |
GIT_USER_EMAIL: github-actions[bot]@users.noreply.github.com | |
FLATPAK_ID: in.cinny.Cinny | |
jobs: | |
flatpak-external-data-checker: | |
name: 'Check update (${{ matrix.branch || github.ref_name }})' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
branch: ['master'] | |
steps: | |
- uses: actions/[email protected] | |
with: | |
submodules: true | |
ref: ${{ matrix.branch }} | |
- 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@v2 | |
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 node/cargo sources | |
if: steps.is-updated.outputs.updated | |
run: | | |
git submodule update --init | |
ver=$(grep release in.cinny.Cinny.appdata.xml | grep -m1 -oP '(?<=version=.)[^"]+') | |
git clone --recursive -b "v${ver}" --depth=1 https://github.com/cinnyapp/cinny-desktop.git | |
flatpak-builder-tools/cargo/flatpak-cargo-generator.py -o cargo-sources.json cinny-desktop/src-tauri/Cargo.lock | |
flatpak-node-generator --no-requests-cache -r -o node-sources.json npm cinny-desktop/package-lock.json | |
rm -rf cinny-desktop | |
- 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 |