Skip to content

build: Add check version first #32

build: Add check version first

build: Add check version first #32

Workflow file for this run

name: Extracting VerCode - Next
on:
schedule:
- cron: '0 8 * * *'
- cron: '19 15 * * *'
push:
branches: [next]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
region:
- jp
- na
include:
- region: na
game: https://fgo.bigcereal.com/apk/com.aniplex.fategrandorder.en.xapk
version: https://gplay-ver.atlasacademy.workers.dev/?id=com.aniplex.fategrandorder.en
- region: jp
game: https://fgo.bigcereal.com/apk/com.aniplex.fategrandorder.xapk
version: https://gplay-ver.atlasacademy.workers.dev/?id=com.aniplex.fategrandorder
permissions:
packages: write
contents: write
steps:
- name: Gettings files from Repo
uses: actions/checkout@v2
- name: Set Game Version
run: |
$version = Invoke-RestMethod -Uri "${{ matrix.version }}"
echo "VERSION=$version" | Out-File -Append -FilePath $env:GITHUB_ENV
- name: Compare Version with app.json
run: |
$appVersion = (Get-Content -Path "${{ matrix.region }}.json" | ConvertFrom-Json).appVer
$envVersion = $env:VERSION
if ($appVersion -eq $envVersion) {
echo "Versions match! No need to update the code. ✅"
exit 0
} else {
echo "Versions don't match. Please update the code. 🔄"
}
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Download Edit Tools
run: |
Invoke-WebRequest -Uri "https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.10.0.jar" -OutFile "apktool.jar"
Invoke-WebRequest -Uri "https://github.com/REAndroid/APKEditor/releases/download/V1.4.1/APKEditor-1.4.1.jar" -OutFile "apkeditor.jar"
Invoke-WebRequest -Uri "https://github.com/O-Isaac/FGO-VCE/releases/latest/download/FGO-VCE-1.0-SNAPSHOT-jar-with-dependencies.jar" -OutFile "fgo-vce.jar"
- name: Download Game apk
run: |
mkdir apk
Invoke-WebRequest -Uri "${{ matrix.game }}" -OutFile "apk\fate.xapk"
- name: Merge XAPK into apk
run: |
java -jar apkeditor.jar m -i apk/fate.xapk -o apk/fate.apk
rm apk/fate.xapk
- name: Decompiling apk
run: java -jar apktool.jar d apk/fate.apk --output files -f
- name: Get verCode from apk
run: |
java -jar fgo-vce.jar -g files/assets/bin/Data/Managed/Metadata/global-metadata.dat -av ${{ env.VERSION }} -o ${{ matrix.region }}.json
- name: Set current date
run: |
$date = Get-Date -Format 'yyyy-MM-ddTHH:mm:ssZ'
echo "DATE=$date" >> $env:GITHUB_ENV
- name: Upload verCode
uses: EndBug/add-and-commit@v9
with:
pull: '--rebase --autostash'
add: '${{ matrix.region }}.json'
default_author: github_actions
message: |
'✨ Update for ${{ matrix.region }} - Commit on ${{ env.DATE }} 🚀'