Skip to content

Commit

Permalink
Move Wiki to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre601 committed Nov 22, 2024
1 parent a08e0da commit d7b7f16
Show file tree
Hide file tree
Showing 14 changed files with 554 additions and 382 deletions.
53 changes: 42 additions & 11 deletions .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,51 @@
name: Update Wiki
name: Publish wiki

on:
workflow_dispatch:
push:
paths:
- 'wiki/**'
branches:
- 'master'
- '.github/workflows/wiki.yml'
- 'docs/**'
- 'mkdocs.yml'
- 'requirements.txt'

permissions:
actions: read
contents: read
pages: write
id-token: write

concurrency:
group: github-pages
cancel-in-progress: false

jobs:
update:
buildSite:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: SwiftDocOrg/github-wiki-publish-action@v1
with:
path: 'wiki'
env:
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.PAT }}
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python 3.x
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Update Pip and install dependencies
run: |
python -m pip install -U pip
pip install -r requirements.txt
- name: Build Site
run: mkdocs build
- name: Configure GitHub Pages
uses: actions/configure-pages@v4
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'site/'
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v3
id: deployment
3 changes: 3 additions & 0 deletions docs/assets/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.md-header__button.md-logo img, .md-header__button.md-logo svg {
height: 3rem;
}
File renamed without changes
74 changes: 74 additions & 0 deletions docs/assets/js/version-table-gen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
document$.subscribe(async () => {
const url = `https://api.allorigins.win/raw?url=${encodeURIComponent('https://andre601.ch/oneversionremake/protocol_versions.json')}`;

const versions_table = document.querySelector('[data-md-component="versions-table"]');

const headerText = ['Protocol', 'Version', 'Major'];

function createTable(data) {
const table = document.createElement("table");
const tableHead = document.createElement("thead");
const tableBody = document.createElement("tbody");

if(tableHead === null || tableBody === null)
return;

const headRow = document.createElement("tr");
for(let i = 0; i < 3; i++) {
const cell = document.createElement("th");
const text = document.createTextNode(`${headerText[`${i}`]}`);

cell.appendChild(text);
headRow.appendChild(cell);
}

tableHead.appendChild(headRow);

console.log(data.protocols)

for(i in data.protocols){
const value = data.protocols[i];
const row = document.createElement("tr");

const protocol = document.createElement("td");
const protocolText = document.createTextNode(value.protocol)

const version = document.createElement("td");
const versionText = document.createTextNode(value.name)

const major = document.createElement("td");
const majorText = document.createTextNode(value.major)

protocol.appendChild(protocolText);
version.appendChild(versionText);
major.appendChild(majorText);

row.appendChild(protocol);
row.appendChild(version);
row.appendChild(major);

tableBody.appendChild(row);
}

table.appendChild(tableHead);
table.appendChild(tableBody);

versions_table.appendChild(table);
}

async function fetchData() {
const data = await fetch(`${url}`).then(_ => _.json());

__md_set("__versions_data", data, sessionStorage);
createTable(data);
}

if(document.querySelector('[data-md-component="versions-table"]')) {
const cached = __md_get("__versions_data", sessionStorage);
if(cached != null) {
createTable(cached);
} else {
fetchData();
}
}
})
Loading

0 comments on commit d7b7f16

Please sign in to comment.