Skip to content

Commit

Permalink
docs(gh-pages): migrate site to jekyll format (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Jan 7, 2025
1 parent 0b966ad commit dd19307
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 203 deletions.
71 changes: 29 additions & 42 deletions .github/workflows/update-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ name: Update

on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
branches:
- master
types:
- opened
- synchronize
- reopened
push:
branches: [master]
branches:
- master
schedule:
- cron: '0 0 * * *' # every day at midnight
workflow_dispatch:
Expand All @@ -23,24 +28,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal token
fetch-depth: 0 # otherwise, will fail to push refs to dest repo

- name: Cache
id: cache
uses: actions/cache@v4
with:
path: cache
key: none

- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
key: update-${{ github.sha }}

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -52,14 +45,6 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Prepare gh-pages
run: |
# empty contents to ensure deleted igdb are removed
rm -f -r ./gh-pages/*
# copy template back to pages
cp -f -r ./gh-pages-template/* ./gh-pages/
- name: Update
env:
TWITCH_CLIENT_ID: ${{ secrets.TWITCH_CLIENT_ID }}
Expand All @@ -69,27 +54,29 @@ jobs:

- name: Prepare Artifacts # uploading artifacts will fail if not zipped due to very large quantity of files
shell: bash
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
run: |
7z a "./gh-pages.zip" "gh-pages"
7z a "./build.zip" "gh-pages"
- name: Upload Artifacts
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: gh-pages
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
name: update
path: |
${{ github.workspace }}/gh-pages.zip
${{ github.workspace }}/build.zip
gh-pages-template/
if-no-files-found: error
include-hidden-files: true
retention-days: 1

- name: Deploy to gh-pages
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }} # yamllint disable-line rule:line-length
uses: actions-js/[email protected]
with:
github_token: ${{ secrets.GH_BOT_TOKEN }}
author_email: ${{ secrets.GH_BOT_EMAIL }}
author_name: ${{ secrets.GH_BOT_NAME }}
directory: gh-pages
branch: gh-pages
force: false
message: automatic-update-${{ steps.date.outputs.date }}
call-jekyll-build:
needs: update
uses: LizardByte/LizardByte.github.io/.github/workflows/jekyll-build.yml@master
with:
site_artifact: 'update'
extract_archive: 'build.zip'
target_branch: 'gh-pages'
clean_gh_pages: true
secrets:
GH_BOT_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
GH_BOT_NAME: ${{ secrets.GH_BOT_NAME }}
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Information from YouTube API is also added to the database for videos.

## Plans

- [ ] Build with Jekyll
- [x] Build with Jekyll
- [ ] Revamp index page
- [ ] Provide an item page for each API item
- [ ] Remove CNAME after next Sunshine release (> v0.23.1)
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
// setup defaults
let org_name = "LizardByte"
let base_url = `https://db.${org_name.toLowerCase()}.dev`

// scripts to load
let scripts = [
'https://app.lizardbyte.dev/js/levenshtein_distance.js',
'https://app.lizardbyte.dev/js/ranking_sorter.js'
]
let base_url = `https://app.${org_name.toLowerCase()}.dev/GameDB`

// get search options, we will append each platform to this list
let search_options = document.getElementById("search_type")

// get platforms container
platforms_container = document.getElementById("platforms-container")
let platforms_container = document.getElementById("platforms-container")


$(document).ready(function(){
Expand All @@ -21,16 +15,6 @@ $(document).ready(function(){
cache: false,
})

let script_queue = scripts.map(function(script) {
return $.getScript(script)
})

$.when.apply(null, script_queue).done(function() {
get_platform_enums()
get_platform_xref()
initialize()
})

// get platform enums from json file
let platform_enums
let get_platform_enums = function() {
Expand Down Expand Up @@ -134,7 +118,6 @@ $(document).ready(function(){
// Split the string at the end of the last full word
const splitIndex = match[1].length;
const firstPart = string.slice(0, splitIndex);
// const secondPart = string.slice(splitIndex);

return [firstPart, string];
}
Expand Down Expand Up @@ -168,7 +151,7 @@ $(document).ready(function(){
platforms.push(result[platform])
}

let sorted = platforms.sort(rankingSorter("name", "id")).reverse()
let sorted = platforms.sort(window.rankingSorter("name", "id")).reverse()

for(let item in sorted) {
// create search option
Expand Down Expand Up @@ -209,7 +192,7 @@ $(document).ready(function(){
banner.src = sorted[item]['platform_logo']['url'].replace("t_thumb", "t_cover_big")
}
catch (err) {
banner.src = "images/no-logo.png"
banner.src = "/GameDB/assets/img/no-logo.png"
banner.classList.add("bg-dark")
banner.classList.add("bg-gradient")
banner.classList.add("p-4")
Expand All @@ -220,7 +203,7 @@ $(document).ready(function(){
banner_link.append(banner)

let card_body = document.createElement("div")
card_body.className = "bg-dark text-white card-body p-4 rounded-0"
card_body.className = "card-body text-white p-4 rounded-0"
card.appendChild(card_body)

let card_title_link = document.createElement("a")
Expand All @@ -246,7 +229,7 @@ $(document).ready(function(){
card_paragraph_div.appendChild(card_paragraph)

let card_footer = document.createElement("div")
card_footer.className = "card-footer p-2 pt-0 bg-dark text-white border-0 rounded-0"
card_footer.className = "card-footer p-2 pt-0 border-0 rounded-0"
card.appendChild(card_footer)

// get first or last version depending on "category"
Expand Down Expand Up @@ -350,4 +333,8 @@ $(document).ready(function(){
}
})
}

get_platform_enums()
get_platform_xref()
initialize()
})
Loading

0 comments on commit dd19307

Please sign in to comment.