Skip to content

Commit

Permalink
More source code (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSn0wy authored Jul 14, 2024
1 parent 706e995 commit 5be3981
Show file tree
Hide file tree
Showing 46 changed files with 2,214 additions and 3,266 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Automatically update the database when an issue in the compatibility repo gets updated

name: Compatibility List Updater
on:
issues:
types:
- opened
- labeled
- edited
- closed
- deleted
repositories:
- obhq/compatibility
workflow_dispatch:
inputs:
manual:
description: Manually updates the database!

env:
CARGO_TERM_COLOR: always
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_API_TOKEN: ${{ secrets.HOMEBREW_API_TOKEN }}
TMDB_HEX: ${{ secrets.TMDB_HEX }}

defaults:
run:
working-directory: updater/

jobs:
build:
name: obhqWebsite_database_updater
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4

- name: setup rust
run: |
rustup update stable
rustup default stable
- name: restore old images && database
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin gh-pages
git switch gh-pages --force
mkdir -p /home/runner/work/obhqWebsite/temp/updater/images/
# if there are images, copy em over
if [ -d /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/ ]; then
echo "Copying Images"
cp -a -r -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/* /home/runner/work/obhqWebsite/temp/updater/images/
fi
# if there is an old main db, copy it over
if [ -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json ]; then
echo "Copying Old Database"
cp -a -r -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json /home/runner/work/obhqWebsite/temp/updater/database.json
fi
git fetch origin main
git switch main --force
- name: run obhqWebsite_database_updater
run: cargo run --release

- name: Commit and push changes to main
run: |
git fetch origin main
git add game_skips.json -f
git add HBstore.db -f
git add config/config.toml -f
files_to_commit=$(git status --porcelain | grep -E 'M|A|D' | wc -l)
if [ $files_to_commit -gt 0 ]; then
echo "Committing changes!"
git fetch origin main
git commit -m "Automatic Compatibility List Update"
git push origin main
else
echo "No changes to commit."
fi
- name: Commit and push changes to gh-pages
run: |
git fetch origin gh-pages
git switch gh-pages --force
mkdir -p /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/
rm -r -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/games/
rm -r -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/hb/
rm -f /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json
rm -f /home/runner/work/obhqWebsite/obhqWebsite/stats.json
mv -f /home/runner/work/obhqWebsite/temp/updater/images/* /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/
mv -f /home/runner/work/obhqWebsite/temp/updater/database.json /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json
mv -f /home/runner/work/obhqWebsite/temp/updater/stats.json /home/runner/work/obhqWebsite/obhqWebsite/stats.json
git add /home/runner/work/obhqWebsite/obhqWebsite/stats.json -f
git add /home/runner/work/obhqWebsite/obhqWebsite/compatibility/database.json -f
git add /home/runner/work/obhqWebsite/obhqWebsite/compatibility/_images/ -f
files_to_commit=$(git status --porcelain | grep -E 'M|A|D' | wc -l)
if [ $files_to_commit -gt 0 ]; then
echo "Committing changes!"
git fetch origin gh-pages
git commit -m "Automatic Compatibility List Update"
git push origin gh-pages
else
echo "No changes to commit."
fi
57 changes: 57 additions & 0 deletions .github/workflows/mdbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Automatically updates the mdbook on build

name: mdbook updater
on:
push:
branches:
- main
paths:
- mdbook/**
workflow_dispatch:
inputs:
manual:
description: Manually updates the mdbook!

defaults:
run:
working-directory: mdbook/

jobs:
build:
name: mdbook updater
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4

- name: setup rust
run: |
rustup update stable
rustup default stable
- name: install mdbook
run: cargo install mdbook

- name: build mdbook
run: |
mdbook build --dest-dir /home/runner/work/obhqWebsite/temp/wiki/
- name: Commit and push changes to gh-pages
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin gh-pages
git switch gh-pages --force
rm -r -f /home/runner/work/obhqWebsite/obhqWebsite/wiki/
mv -f /home/runner/work/obhqWebsite/temp/wiki/ /home/runner/work/obhqWebsite/obhqWebsite/wiki/
git add /home/runner/work/obhqWebsite/obhqWebsite/wiki/
files_to_commit=$(git status --porcelain | grep -E 'M|A|D' | wc -l)
if [ $files_to_commit -gt 0 ]; then
echo "Committing changes!"
git fetch origin gh-pages
git commit -m "Automatic mdbook Update"
git push origin gh-pages
else
echo "No changes to commit."
fi
55 changes: 55 additions & 0 deletions .github/workflows/public_html.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: public_html update
on:
push:
branches:
- main
paths:
- public_html/**
workflow_dispatch:
inputs:
manual:
description: Manually updates the public_html!

jobs:
build:
name: public_html Updater
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4

- name: Copy files
run: |
mkdir -p /home/runner/work/obhqWebsite/temp/public_html/
cp -a -r -f /home/runner/work/obhqWebsite/obhqWebsite/public_html/* /home/runner/work/obhqWebsite/temp/public_html/
- name: Commit and push changes to gh-pages
run: |
# Switch to gh-pages
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin gh-pages
git switch gh-pages --force
# put the new files into the folder
rm -r -f /home/runner/work/obhqWebsite/obhqWebsite/*
mv -f /home/runner/work/obhqWebsite/temp/public_html/* /home/runner/work/obhqWebsite/obhqWebsite/
touch /home/runner/work/obhqWebsite/obhqWebsite/.nojekyll
git add /home/runner/work/obhqWebsite/obhqWebsite/ -f
# restore files that dont need updating
git restore --staged --worktree wiki/
git restore --staged --worktree compatibility/_images/games/
git restore --staged --worktree compatibility/_images/hb/
git restore --staged --worktree compatibility/database.json
git restore --staged --worktree stats.json
files_to_commit=$(git status --porcelain | grep -E 'M|A|D' | wc -l)
if [ $files_to_commit -gt 0 ]; then
echo "Committing changes!"
git fetch origin gh-pages
git commit -m "Automatic public_html update"
git push origin gh-pages
else
echo "No changes to commit."
fi
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# will have compiled files and executables
debug/
target/
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
Expand All @@ -15,6 +16,12 @@ stuff.txt
.idea
*.db
.htaccess

mdbook/book/
updater/images/
updater/config/config.toml
stats.json
/public_html/Gamma-Boi/compatibility/_images/games/
/public_html/Gamma-Boi/compatibility/_images/hb/

stats.json
database.json
game_skips.json
106 changes: 106 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### [v0.3.1] (unreleased)
- Put the tmdb hex into the config, instead of a secret variable
- Added CSP to the `_errorPages` and some other small fixes

### [v0.3.0]

#### Added

- .yml files for automatic releases
- Modified rust comp updater to get the secrets using the environmental variables
- Added CSP to the pages

#### Changed

- Changed directories of the website
- Aesthetic changes and error handling improvements to the rust comp updater
- Fixed the top bar changing its width when typing on the comp page

#### Removed

- Removed Coming soon page
- Removed `Gamma-Boi`
- Removed inline javascript

### [v0.2.0]

#### Added

- Comp List
- Added mobile support
- Added comments to the javascript code

#### Changed

- General
- Did **a lot of** cleanup and bug fixes with the rust updater script
- Main Page
- Improved mobile support
- Smoll styling changes
- Comp List
- Check if the page search bar contains a number
- fixed `minNumberElement` displaying that there is a page while there isn't
- fixed `x results found` text to display the correct number
- fixed css browser compatibility
- removed unused css
- Moved color accents to `required.css`
- Made `updated_date` automatically change time format based on the user
- Updater Script
- Fixed `game_skips.json` not getting saved
- Made homebrew database updater into a separate function
- Changed the last_updated string into `rfc3339` format
- Tidied up the code for getting the `status_tag`, `code`, and `issue_type`
- Improved error handling
- Merged the two config classes into one
- Fixed folder creation
- Updated the config
- Fixed direction of issues being flipped

### [v0.1.0]

#### Added

- General
- added avif images (if supported on the client) for the logo's, this resulted in a ~90% size reduction of the
images.
- Added an animation for the header when it's done loading


- Main Page
- Added an animation for the `main2` section.


- Comp List
- Added an animation for the status bars when it's done fetching the `storage.json`
- Added animations for the GameCard's
- Added placeholders for when it's fetching the `storage.json`
- Added id/code searching
- Added page searching

#### Changed

- General
- Improved text
- Hid alt text on images
- Finished `animationHandler()`


- Comp List
- Changed the `Playable` color from <span style="background:#24bb2d;">#24bb2d</span>
to <span style="background:#5fac4e;">#5fac4e</span>
- Made `gameCardHandler()` only return the first 10 issues on load
- Improved General code
- Made the `N/A` image text for games without an image to `GAME`

#### Removed

- Comp List
- Removed unnecessary id's for the status bar's
- Removed `addEventListener` in favor of the `onInput` method for the search bar's
1 change: 0 additions & 1 deletion mdbook/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions mdbook/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ src = "src"
edition = "2018"

[build]
build-dir = 'D:\Website\public_html\Gamma-Boi\wiki'
create-missing = false
build-dir = '/home/runner/work/obhqWebsite/temp/wiki/'
create-missing = true
1 change: 1 addition & 0 deletions public_html/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevents Github Pages from being silly
Binary file not shown.
Binary file removed public_html/Gamma-Boi/_images/Obliteration.png
Binary file not shown.
1 change: 0 additions & 1 deletion public_html/Gamma-Boi/_images/discord.svg

This file was deleted.

1 change: 0 additions & 1 deletion public_html/Gamma-Boi/_images/github.svg

This file was deleted.

Loading

0 comments on commit 5be3981

Please sign in to comment.