Skip to content

Commit

Permalink
docs(gh-pages): migrate site to jekyll format
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Jan 5, 2025
1 parent 0b966ad commit eb79bdb
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 199 deletions.
73 changes: 31 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,31 @@ 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
# todo: change to master
uses: LizardByte/LizardByte.github.io/.github/workflows/jekyll-build.yml@feat/build/use-jekyll-and-restyle-website
with:
site_artifact: 'update'
extract_archive: 'build.zip'
target_branch: 'gh-pages'
clean_gh_pages: true
theme_ref: 'feat/build/use-jekyll-and-restyle-website' # todo: remove this line
secrets:
GH_BOT_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
GH_BOT_NAME: ${{ secrets.GH_BOT_NAME }}
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
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 @@ -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 = "/assets/img/no-logo.png"
banner.classList.add("bg-dark")
banner.classList.add("bg-gradient")
banner.classList.add("p-4")
Expand Down Expand Up @@ -350,4 +333,8 @@ $(document).ready(function(){
}
})
}

get_platform_enums()
get_platform_xref()
initialize()
})
188 changes: 51 additions & 137 deletions gh-pages-template/index.html
Original file line number Diff line number Diff line change
@@ -1,143 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>LizardByte - db</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="Video game metadata database." />
<meta name="author" content="" />

<!-- Open Graph/Twitter metadata -->
<meta property="og:site_name" content="LizardByte" />
<meta property="og:title" content="LizardByte" />
<meta property="og:type" content="website" />
<meta property="og:image" content="https://app.lizardbyte.dev/assets/images/og-image.png" />
<meta property="og:url" content="https://db.lizardbyte.dev" />
<meta property="og:description" content="Video game metadata database." />
<meta property="og:locale" content="en-US" />
<meta property="twitter:card" content="summary_large_image" />
<meta property="og:twitter_site" content="@lizardbytedev" />
<meta property="og:twitter_site:id" content="@lizardbytedev" />
<meta property="og:twitter_creator" content="@lizardbytedev" />
<meta property="og:twitter_creator:id" content="@lizardbytedev" />
<meta property="twitter:image" content="https://app.lizardbyte.dev/assets/images/og-image.png" />

<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="https://app.lizardbyte.dev/assets/images/favicon.ico" />
<!-- FontAwesome-->
<link href="https://app.lizardbyte.dev/node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet" />
<!-- Material icons-->
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" rel="stylesheet" />

<!-- Bootstrap theme-->
<link href="https://app.lizardbyte.dev/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
<!-- Custom css-->
<link href="https://app.lizardbyte.dev/css/custom.css" rel="stylesheet" />

<script src="https://app.lizardbyte.dev/node_modules/jquery/dist/jquery.min.js"></script>
<script src="https://app.lizardbyte.dev/node_modules/@popperjs/core/dist/umd/popper.min.js"></script>
</head>
<body class="d-flex flex-column h-100 bg-dark-gray">
<main class="flex-shrink-0 overflow-hidden">
<!-- Navigation-->
<nav id="nav-container"></nav>

<div class="container px-auto my-5">
<div class="col-lg-12 mx-auto" id="db-container" style="min-width: 335px">

<!-- Search section-->
<section class="py-5 offset-anchor" id="Search">
<div class="container mb-5">
<form id="searchForm">
<div class="form-group d-flex">
<div class="col-3 me-3">
<select class="form-select rounded-0" aria-label="Search Type" id="search_type">
</select>
</div>
<div class="col-6 me-3">
<input type="text" class="form-control rounded-0" placeholder="Search" id="search_term">
</div>
<button type="button" class="btn btn-warning ml-3 rounded-0" onclick="run_search()">
<i class="fa-fw fas fa-search"></i>Search</button>
</div>
</form>
---
title: GameDB
layout: page
full-width: true
after-content:
- donate.html
- support.html

# TODO: Add `cover-img` (supports multiple)

ext-css:
- href: https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200
ext-js:
- https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
- https://cdn.jsdelivr.net/npm/@lizardbyte/[email protected]/dist/levenshtein-distance.js
- https://cdn.jsdelivr.net/npm/@lizardbyte/[email protected]/dist/ranking-sorter.js
js:
- /assets/js/item_loader.js
---

<div class="container px-auto my-5">
<div class="col-lg-12 mx-auto" id="db-container" style="min-width: 335px">

<!-- Search section-->
<section class="py-5 offset-anchor" id="Search">
<div class="container mb-5">
<form id="searchForm">
<div class="form-group d-flex">
<div class="col-3 me-3">
<select class="form-select rounded-0" aria-label="Search Type" id="search_type">
</select>
</div>
<div id="search-container"></div>
</section>

<!-- Platforms section-->
<section class="py-5 offset-anchor" id="Platforms">
<div class="row gx-5 justify-content-center">
<div class="col-lg-8 col-xl-6">
<div class="text-center text-white">
<h2 class="fw-bolder">Platforms</h2>
</div>
</div>
<div class="col-6 me-3">
<input type="text" class="form-control rounded-0" placeholder="Search" id="search_term">
</div>
<div class="row gx-5" id="platforms-container"></div>
</section>

</div>
<button type="button" class="btn btn-warning ml-3 rounded-0" onclick="run_search()">
<i class="fa-fw fas fa-search"></i>Search</button>
</div>
</form>
</div>

<!-- Donate section-->
<section class="offset-anchor bg-dark p-5" id="Donate">
<div class="container mb-5 shadow border-0 bg-dark-gray rounded-0 col-md-7">
<div class="d-table-row g-0 text-white">
<div class="d-table-cell px-3 align-middle text-center">
<h1>
<i class="fa-fw fas fa-coins"></i>
</h1>
</div>
<div class="col-sm-auto border-white my-3 px-3 py-2 border-start">
<div class="container">
<h4 class="card-title mb-3 fw-bolder">Donate</h4>
</div>
<a
class="text-decoration-none"
href="https://github.com/sponsors/LizardByte"
target="_blank">
<img class="m-3"
alt="GitHub Sponsors"
src="https://img.shields.io/github/sponsors/lizardbyte?label=Github%20Sponsors&style=for-the-badge&color=green&logo=githubsponsors"
>
</a>
<a
class="text-decoration-none"
href="https://www.patreon.com/LizardByte"
target="_blank">
<img class="m-3"
alt="Patreon"
src="https://img.shields.io/badge/dynamic/json?color=green&label=Patreon&style=for-the-badge&query=patron_count&url=https%3A%2F%2Fapp.lizardbyte.dev%2Fdashboard%2Fpatreon%2FLizardByte.json&logo=patreon"
>
</a>
<a
class="text-decoration-none"
href="https://www.paypal.com/paypalme/ReenigneArcher"
target="_blank">
<img class="m-3"
alt="PayPal"
src="https://img.shields.io/static/v1?style=for-the-badge&label=PayPal&message=Donate&color=green&logo=paypal"
>
</a>
</div>
<div id="search-container"></div>
</section>

<!-- Platforms section-->
<section class="py-5 offset-anchor" id="Platforms">
<div class="row gx-5 justify-content-center">
<div class="col-lg-8 col-xl-6">
<div class="text-center text-white">
<h2 class="fw-bolder">Platforms</h2>
</div>
</div>
</section>

</main>
<!-- Footer-->
<footer class="bg-dark py-4 mt-auto" id="footer-container"></footer>
<!-- Bootstrap core JS-->
<script src="https://app.lizardbyte.dev/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</div>
<div class="row gx-5" id="platforms-container"></div>
</section>

<!-- Get navbar -->
<script src="https://app.lizardbyte.dev/js/navbar.js"></script>
<!-- Get footer -->
<script src="https://app.lizardbyte.dev/js/footer.js"></script>
<!-- Discord WidgetBot -->
<script src="https://app.lizardbyte.dev/js/discord.js"></script>
<!-- load games and movies -->
<script src="js/item_loader.js"></script>
</body>
</html>
</div>
</div>

0 comments on commit eb79bdb

Please sign in to comment.