AH Update #3132
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: AH Update | |
on: | |
workflow_dispatch: | |
inputs: | |
compress_all: | |
description: 'compress all records' | |
required: false | |
type: boolean | |
default: false | |
schedule: | |
# 12 times a day | |
- cron: '0 */2 * * *' | |
jobs: | |
test: | |
uses: ./.github/workflows/test.yml | |
with: | |
upload-coverage: false | |
ah_update: | |
runs-on: ubuntu-latest | |
environment: env_main | |
permissions: | |
contents: write | |
needs: test | |
steps: | |
# checkout 'latest' tag | |
- uses: actions/checkout@v4 | |
with: | |
ref: latest | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Set up environment variables | |
run: | | |
echo "JOB_START_TS=$(date +%s)" >> $GITHUB_ENV | |
echo "DB_PATH=/tmp/ah_db" >> $GITHUB_ENV | |
- name: Get AH Database File from GitHub Cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.DB_PATH }} | |
# save cache, caches are evicted after 7 days | |
# or by ascending access time if over 10GB | |
# https://github.com/actions/cache/issues/2#issuecomment-548426628 | |
key: ${{ runner.os }}-ah-${{ env.JOB_START_TS }} | |
# load most recently created cache | |
restore-keys: | | |
${{ runner.os }}-ah- | |
- name: Run AH Update | |
env: | |
BN_CLIENT_ID: ${{ secrets.BN_CLIENT_ID }} | |
BN_CLIENT_SECRET: ${{ secrets.BN_CLIENT_SECRET }} | |
# how to access environment variables in GitHub Actions | |
# https://dev.to/this-is-learning/secrets-and-environment-variables-in-your-github-action-1pfn | |
BN_OAUTH_URL: ${{ vars.BN_OAUTH_URL }} | |
BN_OAUTH_URL_CN: ${{ vars.BN_OAUTH_URL_CN }} | |
run: > | |
printf %s\\n | |
retail tw classic_era tw classic tw | |
retail kr classic_era kr classic kr | |
classic_era us classic_era eu | | |
xargs -n2 | |
python -m ah.updater | |
${{ inputs.compress_all && '--compress_all ' || ' ' }} | |
--db_path ${{ env.DB_PATH }} | |
--game_version | |
- name: Release DB - TW | |
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 | |
with: | |
tag_name: latest | |
files: | | |
${{ env.DB_PATH }}/*tw*.gz | |
${{ env.DB_PATH }}/*tw*.bin | |
${{ env.DB_PATH }}/*tw*.json | |
name: DB ${{ env.JOB_START_TS }} | |
- name: Reset Rate Limit (sleep 1 minute) | |
run: sleep 60 | |
- name: Release DB - KR | |
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 | |
with: | |
tag_name: latest | |
files: | | |
${{ env.DB_PATH }}/*kr*.gz | |
${{ env.DB_PATH }}/*kr*.bin | |
${{ env.DB_PATH }}/*kr*.json | |
name: DB ${{ env.JOB_START_TS }} | |
- name: Reset Rate Limit (sleep 1 minute) | |
run: sleep 60 | |
- name: Release DB - US | |
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 | |
with: | |
tag_name: latest | |
files: | | |
${{ env.DB_PATH }}/*us*.gz | |
${{ env.DB_PATH }}/*us*.bin | |
${{ env.DB_PATH }}/*us*.json | |
name: DB ${{ env.JOB_START_TS }} | |
- name: Reset Rate Limit (sleep 1 minute) | |
run: sleep 60 | |
- name: Release DB - EU | |
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 | |
with: | |
tag_name: latest | |
files: | | |
${{ env.DB_PATH }}/*eu*.gz | |
${{ env.DB_PATH }}/*eu*.bin | |
${{ env.DB_PATH }}/*eu*.json |