.github/workflows/ruffle-update.yml #7
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 Ruffle | |
on: | |
schedule: | |
- cron: '0 0 * * *' # run everyday at midnight | |
workflow_dispatch: # allows manual trigger | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # load nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # load nvm bash_completion | |
nvm install 20 | |
- name: Download Ruffle | |
run: | | |
curl -o ruffle.zip -L https://github.com/ruffle-rs/ruffle/releases/latest/download/ruffle_web_latest.zip | |
unzip ruffle.zip -d ruffle_new | |
- name: Backup existing Ruffle | |
run: | | |
mv ruffle ruffle_backup || true | |
- name: Copy new Ruffle files | |
run: | | |
cp -r ruffle_new/. ruffle/ | |
if [ -f "ruffle_new/loader.js" ]; then | |
cp -n ruffle_new/loader.js ruffle/ | |
fi | |
- name: Remove old Ruffle | |
run: | | |
rm -rf ruffle_backup | |
- name: Commit and push if it changed | |
run: | | |
git config user.name "Ruffle Updater" | |
git config user.email "xordas@xordas.me" | |
git add -A | |
git diff --quiet && git diff --staged --quiet || git commit -m "Update Ruffle" | |
git push |