Update Repo #1361
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: Update Repo | |
on: | |
schedule: | |
- cron: '30 22 * * *' | |
workflow_dispatch: | |
jobs: | |
update-versions: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v2 | |
- name: setup python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: install dependencies | |
run: | | |
if [ -f ./requirements_versions.txt ]; then pip3 install -r ./requirements_versions.txt; fi | |
- name: run script | |
run: | | |
python3 process_versions.py | |
- name: push changes | |
run: | | |
git config --global user.name 'HamletDuFromage' | |
git config --global user.email '90281142+Homletbot@users.noreply.github.com' | |
git add versions.json | |
git add versions/* | |
if [[ `git status --porcelain` ]]; then | |
git commit -m "automatic: updated version files" | |
git push | |
else | |
echo "Nothing to commit!" | |
fi | |
update-cheats: | |
needs: update-versions | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v2 | |
with: | |
ref: 'master' | |
- name: setup python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: install python dependencies | |
run: | | |
if [ -f ./requirements_cheats.txt ]; then pip3 install -r ./requirements_cheats.txt; fi | |
- name: install dependencies | |
run: sudo apt-get install unrar | |
- name: run python script | |
run: | | |
python3 database_builder.py | |
- name: push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name 'HomletBot' | |
git config --global user.email '90281142+Homletbot@users.noreply.github.com' | |
git add cheats/ cheats_gfx/ cheats_gbatemp/ | |
stat=$(git status --porcelain) | |
if [ ! -z "$stat" ]; then | |
git commit -m "automatic: updated cheat files" | |
git push | |
version=$(cat VERSION) | |
echo -e "Last updated: **$version**\n\nCheats updated:↷\n\`\`\`\n$(echo $stat | xargs python3 build_changelog.py)\n\`\`\`" > changelog.md | |
gh release create $version -F changelog.md | |
gh release upload $version ./gbatemp/contents.zip --clobber | |
gh release upload $version ./gbatemp/titles.zip --clobber | |
mv ./NX-60FPS-RES-GFX-Cheats-main/contents.zip ./NX-60FPS-RES-GFX-Cheats-main/contents_60fps-res-gfx.zip | |
mv ./NX-60FPS-RES-GFX-Cheats-main/titles.zip ./NX-60FPS-RES-GFX-Cheats-main/titles_60fps-res-gfx.zip | |
gh release upload $version ./NX-60FPS-RES-GFX-Cheats-main/contents_60fps-res-gfx.zip --clobber | |
gh release upload $version ./NX-60FPS-RES-GFX-Cheats-main/titles_60fps-res-gfx.zip --clobber | |
mv ./complete/contents.zip ./complete/contents_complete.zip | |
mv ./complete/titles.zip ./complete/titles_complete.zip | |
gh release upload $version ./complete/contents_complete.zip --clobber | |
gh release upload $version ./complete/titles_complete.zip --clobber | |
gh release upload $version VERSION --clobber | |
else | |
echo "Nothing to commit!" | |
fi |