Skip to content

priconne-database #24697

priconne-database

priconne-database #24697

# This workflow will auto download a database and push any changes if found
name: priconne-database
on:
# run this task every minute 45 of every hr of every day
# preload usually happens at minute 45? but actions fires 5mins later
schedule:
- cron: '45 * * * *'
# allow this task to be run manually from Actions tab
workflow_dispatch:
jobs:
# needs access to {{ secrets.DEPLOY_ACCESS_TOKEN }} with at least public_repo scope
build:
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Node.js [16.x]
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'npm'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install Node.js dependencies
run: npm install @actions/core brotli python-shell
- name: Run check-for-updates.js
id: check_for_updates
run: node ./src/check-for-updates.js
# Python 3.12.0+ seems to break UnityPy build.
- name: Setup Python [3.11.5]
if: ${{ steps.check_for_updates.outputs.success == 'true' }}
uses: actions/setup-python@v3
with:
python-version: '3.11.5'
# btw for some reason installing UnityPack here causes issues
# it's kind of a pain to debug sooooo UnityPack is provided in vendor/UnityPack
- name: Install Python dependencies
if: ${{ steps.check_for_updates.outputs.success == 'true' }}
run: pip install UnityPy==1.9.28
- name: Run download-database.js
if: ${{ steps.check_for_updates.outputs.success == 'true' }}
id: download_database
run: node ./src/download-database.js
# assuming there are new changes
- name: Update files on Git
if: ${{ steps.check_for_updates.outputs.success == 'true' }}
run: |
git config --global user.name "Expugn"
git config --global user.email "Expugn@users.noreply.github.com"
git add ./master_cn.db
git add ./master_en.db
git add ./master_jp.db
git add ./master_kr.db
git add ./master_th.db
git add ./master_tw.db
git add ./version.json
git commit -m "[Bot] Database Updates - ${{ steps.download_database.outputs.title }}" -m '
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
This is an automated process. Issues may or may not have occured.
${{ steps.download_database.outputs.diff }}'
git push
env:
github_token: ${{ secrets.DEPLOY_ACCESS_TOKEN }}
repository: ${{ github.repository }}