Skip to content

Nightly Update (EN) #73

Nightly Update (EN)

Nightly Update (EN) #73

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/medarot4:tr_EN
steps:
- name: List versions
run: |
git --version
python3 --version
rgbasm --version
rgblink --version
rgbgfx --version
- name: Checkout main repository
uses: actions/checkout@v4
with:
path: 'code'
- name: Checkout baserom repository
uses: actions/checkout@v4
with:
repository: ${{ secrets.BASEROM_REPOSITORY }}
ssh-key: ${{ secrets.BASEROM_KEY }}
path: 'baserom'
- name: Copy baserom into main repository
run: |
cp $GITHUB_WORKSPACE/baserom/*.gbc $GITHUB_WORKSPACE/code
- name: Get Tag Info
working-directory: 'code'
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: 'code'
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: 'code'
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 medarot4_*.gbc > medarot4.sha1sum
git diff --exit-code && exit 0 || echo -n $NIGHTLY_TAG_NAME > ./text/patch/tag.txt
make -j all
sha1sum medarot4_*.gbc > medarot4.sha1sum
git commit -am "Update tag"
git push
mkdir patch
cp medarot4.sha1sum ./patch/
flips --create baserom_kabuto.gbc medarot4_kabuto.gbc ./patch/medarot4kabuto-$GITHUB_RUN_NUMBER-`git rev-parse HEAD`.bps
flips --create baserom_kuwagata.gbc medarot4_kuwagata.gbc ./patch/medarot4kuwagata-$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 medarot4 -delete $NIGHTLY_TAG_NAME ./patch/