Skip to content

Commit

Permalink
👷 Add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed May 11, 2024
1 parent 01ae107 commit 9802c99
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Fetch Res

on:
workflow_dispatch: ~

jobs:
Fetch-Wiki:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@master

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install Dependencies
run: |
python -m pip install httpx black
- name: Fetch Remote Files
run: |
cd compiler
python main.py
cd ..
black .
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Commit changes
run: |
git add .
git commit -S -m ":bento: Update res"
git push
26 changes: 26 additions & 0 deletions compiler/get_character_promotions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from httpx import get

url = "https://raw.githubusercontent.com/fribbels/hsr-optimizer/main/src/data/character_promotions.json"


def get_content() -> str:
req = get(url)
return req.text


def save_content(content: str) -> None:
with open(
"../src/starrailrelicscore/data/character_promotions.json",
"w",
encoding="utf-8",
) as file:
file.write(content)


def main():
content = get_content()
save_content(content)


if __name__ == "__main__":
main()
24 changes: 24 additions & 0 deletions compiler/get_relic_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from httpx import get

url = "https://raw.githubusercontent.com/PaiGramTeam/HonkaiStarRailWikiDataParser/remote/data/relic_config.json"


def get_content() -> str:
req = get(url)
return req.text


def save_content(content: str) -> None:
with open(
"../src/starrailrelicscore/data/relic_config.json", "w", encoding="utf-8"
) as file:
file.write(content)


def main():
content = get_content()
save_content(content)


if __name__ == "__main__":
main()
13 changes: 13 additions & 0 deletions compiler/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from get_metadata import main as get_metadata
from get_character_promotions import main as get_character_promotions
from get_relic_config import main as get_relic_config


def main():
get_metadata()
get_character_promotions()
get_relic_config()


if __name__ == "__main__":
main()
1 change: 0 additions & 1 deletion src/starrailrelicscore/data/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

METADATA_CH_TYPE = Dict[str, Union[Dict[Parts, List[Stats]], Dict[Stats, float]]]
METADATA_TYPE = Dict[int, METADATA_CH_TYPE]

METADATA = {
1001: { # March 7th
"stats": {
Expand Down

0 comments on commit 9802c99

Please sign in to comment.