-
Notifications
You must be signed in to change notification settings - Fork 20
91 lines (86 loc) · 3.47 KB
/
next.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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. ✅"
echo "UPDATE=false" | Out-File -Append -FilePath $env:GITHUB_ENV # Establece UPDATE como false
} else {
echo "Versions don't match. Please update the code. 🔄"
echo "UPDATE=true" | Out-File -Append -FilePath $env:GITHUB_ENV # Establece UPDATE como true
}
- name: Set up JDK
if: env.UPDATE == 'true'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Download Edit Tools
if: env.UPDATE == 'true'
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
if: env.UPDATE == 'true'
run: |
mkdir apk
Invoke-WebRequest -Uri "${{ matrix.game }}" -OutFile "apk\fate.xapk"
- name: Merge XAPK into apk
if: env.UPDATE == 'true'
run: |
java -jar apkeditor.jar m -i apk/fate.xapk -o apk/fate.apk
rm apk/fate.xapk
- name: Decompiling apk
if: env.UPDATE == 'true'
run: java -jar apktool.jar d apk/fate.apk --output files -f
- name: Get verCode from apk
if: env.UPDATE == 'true'
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
if: env.UPDATE == 'true'
run: |
$date = Get-Date -Format 'yyyy-MM-ddTHH:mm:ssZ'
echo "DATE=$date" >> $env:GITHUB_ENV
- name: Upload verCode
if: env.UPDATE == 'true'
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 }} 🚀'