Skip to content

Nightly Update (EN) #454

Nightly Update (EN)

Nightly Update (EN) #454

name: Nightly Update (EN)
on:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
container: ghcr.io/medabots/medarot3:tr_EN
steps:
- name: List versions
run: |
git --version
python3 --version
rgbasm --version
rgblink --version
rgbgfx --version
- name: Checkout main repository
uses: actions/checkout@v2
with:
path: 'medarot3'
- name: Checkout baserom repository
uses: actions/checkout@v2
with:
repository: ${{ secrets.BASEROM3_REPOSITORY }}
ssh-key: ${{ secrets.BASEROM3_KEY }}
path: 'baserom'
- name: Copy baserom into main repository
run: |
cp $GITHUB_WORKSPACE/baserom/*.gbc $GITHUB_WORKSPACE/medarot3
- name: Get Tag Info
working-directory: 'medarot3'
run: |
git fetch --tags --all
echo "TAG_NAME=`git rev-parse --abbrev-ref HEAD`" >> $GITHUB_ENV
echo "LATEST_TAG_NAME=`git tag --list --sort=-authordate \"\`git name-rev --name-only HEAD\`+nightly.*\" | head -n 1`" >> $GITHUB_ENV
echo "NIGHTLY_TAG_NAME=`git rev-parse --abbrev-ref HEAD`+nightly.`date +%Y%m%d`" >> $GITHUB_ENV
- name: Get latest text from source
working-directory: 'medarot3'
env:
TRANSLATION_SHEET: sheet.xlsx
run: |
wget -q --no-check-certificate "${{ secrets.TRANSLATION_SHEET_URL_SOURCE }}" -O $TRANSLATION_SHEET
make -j dump_xlsx
git status --porcelain
- name: Push and release if there are changes
working-directory: 'medarot3'
run: |
[ -z "$(git status --porcelain)" ] && git diff --exit-code $LATEST_TAG_NAME && exit 0
git config user.email "${{ secrets.USER_EMAIL }}"
git config user.name "$GITHUB_ACTOR"
git commit -am "Nightly text update - `date +%Y%m%d`" && git push || echo "No text changes"
make -j all
sha1sum medarot3_*.gbc > medarot3.sha1sum
git diff --exit-code && exit 0 || echo -n $NIGHTLY_TAG_NAME > ./text/patch/tag.txt
make -j all
sha1sum medarot3_*.gbc > medarot3.sha1sum
git commit -am "Update tag"
git push
mkdir patch
cp medarot3.sha1sum ./patch/
flips --create baserom_kabuto.gbc medarot3_kabuto.gbc ./patch/m3kabuto-$GITHUB_RUN_NUMBER-`git rev-parse HEAD`.bps
flips --create baserom_kuwagata.gbc medarot3_kuwagata.gbc ./patch/m3kuwagata-$GITHUB_RUN_NUMBER-`git rev-parse HEAD`.bps
ghr -t ${{ secrets.GITHUB_TOKEN }} -b "Apply the patch for the version you want to the original ROM for that version with a BPS patcher such as https://medabots.github.io/RomPatcher.js/" -u $GITHUB_REPOSITORY_OWNER -r medarot3 -delete $NIGHTLY_TAG_NAME ./patch/