forked from astral4/arkdata
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (88 loc) · 3.23 KB
/
push.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Update assets
on:
workflow_dispatch:
schedule:
- cron: "0 */4 * * *"
jobs:
check:
runs-on: ubuntu-22.04
outputs:
status: ${{ steps.early.outputs.status }}
steps:
- name: export needed files
run: |
curl https://raw.githubusercontent.com/akgcc/arkdata/main/cmp_version.py > cmp_version.py
curl https://raw.githubusercontent.com/akgcc/arkdata/main/cache/versions.json > versions.json
- id: early
name: Early exit
run: |
python cmp_version.py
if [ -f "NO_UPDATE_NEEDED" ]; then
echo "status=failure" >> $GITHUB_OUTPUT
else
echo "status=success" >> $GITHUB_OUTPUT
fi
main:
runs-on: ubuntu-22.04
needs: check
if: needs.check.outputs.status == 'success'
steps:
- name: Check for lock file
run: |
if [ -f ".github/LOCK_FAIL" ]; then
echo "Previous run failed, skipping this run."
exit 1
fi
- name: Checkout
uses: actions/checkout@v3
- name: Convert Poetry lockfile
run: |
pipx install poetry
poetry export -f requirements.txt -o requirements.txt --without-hashes
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: "pip"
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Install audio dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libogg-dev libvorbis-dev
- name: Get FBS definitions
run: git clone https://github.com/MooncellWiki/OpenArknightsFBS.git
- name: Get flatbuffers
run: git clone https://github.com/google/flatbuffers.git
- name: Build flatc
run: cd ./flatbuffers/CMake && cmake -G "Unix Makefiles" .. && make install DESTDIR=../../
- name: Install modified kawapack
run: pip install git+https://github.com/akgcc/kawapack
- name: Update config with sounds
run: python append_sounds.py
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Build app
run: cargo build --release
- name: Run app
env:
PYTHONUNBUFFERED: 1 # Ensure Python output is flushed
run: ./target/release/arkdata
- name: Commit updates
run: |
git config --global user.name "Kawabot"
git config --global user.email "[email protected]"
git pull --all
git add cache
git add assets
git diff-index --quiet HEAD || git commit -m "Update data" && git push
- name: Update lock file on failure
if: failure()
run: |
# Create the lock file if the task failed
git config --global user.name "Kawabot"
git config --global user.email "[email protected]"
git pull --all
echo "Task failed" > .github/LOCK_FAIL
git add .github/LOCK_FAIL
git diff-index --quiet HEAD || git commit -m "Update failed, create lock file" && git push