From 118a6d0caf430181af42b85f50bcfc3f29b6924d Mon Sep 17 00:00:00 2001 From: Anh H Nguyen Date: Tue, 2 Jan 2024 23:37:05 -0500 Subject: [PATCH 1/4] WIP: CI/CD with actions --- .github/workflows/deploy.yaml | 26 +++++++++++++++++++++ README.md | 14 ++++++++--- database/helper/sv-faces-from-gh-release.sh | 0 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy.yaml create mode 100644 database/helper/sv-faces-from-gh-release.sh diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..b18da31 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,26 @@ +name: Deploy API server with database + +on: + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + name: Deploy API server with database + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.21.x' + + - name: Install other dependencies + run: sudo apt install -y curl jq build-essential + + - name: Download servant faces from Github release + run: curl -LO $(curl -s "https://api.github.com/repos/aaanh/reroll.ing/releases" | jq -r '.[0].assets[0].browser_download_url') + + - name: Generate .env for API server + run: \ No newline at end of file diff --git a/README.md b/README.md index da85c1e..6ebef41 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,16 @@ I, however, hold copyright for the source code and my trade names. - [ ] Symbol - [x] FE: Servants rarity indicators - [x] Text only - - [ ] Symbol + - [x] Symbol - [ ] FE: Staggered render +- [x] FE: Servant information page (dynamic routing) - [ ] DB: Scheduled data update task - [x] DB: Servant images - [x] Image retrieval - [x] Store to image database - [ ] Caching - [ ] SV: API rate limiting +- [ ] DevOps: Automated deployment ## Frontend/UI @@ -81,10 +83,16 @@ def fetch_new_data(): return data def update_db(json_data): + """ + Update the SQLite database with the data from the json file + """ + + current_path = os.getcwd() for i in range(len(json_data)): try: - cur.execute("INSERT INTO servants (collectionNo, sv_name, rarity, class_name, face) VALUES (?, ?, ?, ?, ?)", - (json_data[i]['collectionNo'], json_data[i]['name'], json_data[i]['rarity'], json_data[i]['className'], json_data[i]['face'])) + face_path = f"https://api.reroll.ing/assets/{json_data[i]['collectionNo']}.png" + cur.execute("INSERT INTO servants (collectionNo, sv_original_name, sv_name, rarity, class_name, atk_max, hp_max, attribute, face_url, face_path) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + (json_data[i]['collectionNo'], json_data[i]['originalName'], json_data[i]['name'], json_data[i]['rarity'], json_data[i]['className'], json_data[i]['atkMax'], json_data[i]['hpMax'], json_data[i]['attribute'], json_data[i]['face'], face_path)) except sqlite3.IntegrityError: print( f"Servant already exists in database, skipping: {json_data[i]['collectionNo']} - \"{json_data[i]['name']}\"") diff --git a/database/helper/sv-faces-from-gh-release.sh b/database/helper/sv-faces-from-gh-release.sh new file mode 100644 index 0000000..e69de29 From 4e403e2840f7356d56467da6b93c09000a89d08e Mon Sep 17 00:00:00 2001 From: Anh Hoang Nguyen Date: Wed, 3 Jan 2024 03:17:49 -0500 Subject: [PATCH 2/4] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 6ebef41..902dc1e 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,11 @@ I, however, hold copyright for the source code and my trade names. ## Features and TODOs +- [ ] DevOps: Reset/Improve versioning + - [ ] Follow semver + - [ ] Automate tag generation + - [ ] Automate version increment + - [ ] Separate versioning for each component - [x] Func: Single roll - [x] Func: Multi roll - [x] FE: Servants card face From 7e6676ecf970edc89b3589686a9a030e24ba460e Mon Sep 17 00:00:00 2001 From: Anh Hoang Nguyen Date: Wed, 3 Jan 2024 03:24:22 -0500 Subject: [PATCH 3/4] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 902dc1e..f7134d3 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,14 @@ So... I built this full-stack FGO gacha simulator in, what is to me, a record time of 5 days (to be verified with commit history 🤡). -## Notice +## N.B. I do not own the characters, names, and attributes that might appear during the usage of this software. Those are the intellectual properties of their respective copyright holders. I, however, hold copyright for the source code and my trade names. +I'm not affiliated with any entities mentioned or whose resource I use in this project, e.g. FGO and its owner, Atlas Academy, and others, but myself. Nor do I claim to be partnered with, sponsored or funded by the aforementioned. + ## Features and TODOs - [ ] DevOps: Reset/Improve versioning From 3855aff137888996b3eea725ced69f1fa8cb4fdf Mon Sep 17 00:00:00 2001 From: Anh Hoang Nguyen Date: Thu, 4 Jan 2024 04:32:51 -0500 Subject: [PATCH 4/4] Hotfix: height of roll result container --- frontend/src/pages/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/pages/index.tsx b/frontend/src/pages/index.tsx index 67981e4..de5ad47 100644 --- a/frontend/src/pages/index.tsx +++ b/frontend/src/pages/index.tsx @@ -86,7 +86,7 @@ export default function Home() {
-
+
{rolls.map((roll: Roll, idx: number) => )}