Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 91 additions & 88 deletions .github/workflows/mkdocs_ci.yml → .github/workflows/zensical_ci.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,91 @@
name: Mkdocs Deploy
on:
repository_dispatch:
types: [maintainerr-release]
workflow_dispatch:
inputs:
versionInput:
description: 'Input version from Maintainerr release'
required: true
isDev:
description: 'Is this a dev version?'
required: true
type: boolean

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || github.ref}}
sparse-checkout: |
docs
layouts

- name: Validate Version Input
run: |
VERSION="${{ github.event.inputs.versionInput || github.event.client_payload.versionInput }}"

if [[ ! "$VERSION" =~ ^[a-zA-Z0-9._-]+$ ]]; then
echo "Invalid version format: '$VERSION'"
echo "Allowed characters: letters, numbers, dots (.), hyphens (-), and underscores (_)"
exit 1
fi
echo "Version format is valid: $VERSION"

- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com

- uses: actions/setup-python@v5
with:
python-version: 3.x

- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV

- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-

- run: sudo apt-get install pngquant
- run: pip install mkdocs-glightbox
- run: pip install mkdocs-swagger-ui-tag
- run: pip install "mkdocs-material[imaging]"
- run: pip install mike
- run: pip install mkdocs-git-revision-date-localized-plugin
- run: pip install mkdocs-git-committers-plugin-2
- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git

- name: Deploy Documentation
run: |
VERSION="${{ github.event.inputs.versionInput || github.event.client_payload.versionInput }}"

if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
mike deploy --update-aliases "$VERSION" latest
else
if [ "${{ github.event.inputs.isDev }}" == "false" ]; then
mike deploy --update-aliases "$VERSION" latest
else
mike deploy --push --update-aliases "$VERSION" dev
fi
fi

- name: Set Default Version to Latest
if: github.event_name == 'repository_dispatch' || github.event.inputs.isDev == 'false'
run: mike set-default --push --allow-empty latest

env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
name: Documentation Deploy
on:
repository_dispatch:
types: [maintainerr-release]
workflow_dispatch:
inputs:
versionInput:
description: 'What version of Maintainerr are these docs for?'
required: true
isDev:
description: 'Is this a dev version?'
required: true
type: boolean

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

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:
- uses: actions/configure-pages@v5
- uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.ref || github.ref}}
sparse-checkout: |
docs
layouts

- name: Validate Version Input
run: |
VERSION="${{ github.event.inputs.versionInput || github.event.client_payload.versionInput }}"

if [[ ! "$VERSION" =~ ^[a-zA-Z0-9._-]+$ ]]; then
echo "Invalid version format: '$VERSION'"
echo "Allowed characters: letters, numbers, dots (.), hyphens (-), and underscores (_)"
exit 1
fi
echo "Version format is valid: $VERSION"

- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com

- uses: actions/setup-python@v5
with:
python-version: 3.x

- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV

- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-

- run: pip install zensical
- run: zensical build --clean
- uses: actions/upload-pages-artifact@v4
with:
path: site
- uses: actions/deploy-pages@v4
- name: Deploy Documentation
run: |
VERSION="${{ github.event.inputs.versionInput || github.event.client_payload.versionInput }}"

if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
mike deploy --update-aliases "$VERSION" latest
else
if [ "${{ github.event.inputs.isDev }}" == "false" ]; then
mike deploy --update-aliases "$VERSION" latest
else
mike deploy --push --update-aliases "$VERSION" dev
fi
fi

- name: Set Default Version to Latest
if: github.event_name == 'repository_dispatch' || github.event.inputs.isDev == 'false'
run: mike set-default --push --allow-empty latest

env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
49 changes: 47 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
.cache
# System files
.DS_Store
Thumbs.db
desktop.ini

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
.env
.venv
env/
venv/
ENV/
dist/
build/
*.egg-info/

# MkDocs/Documentation
site/
.cache/
.temp/
.doctrees/

# IDE
.idea/
.vscode/
*.swp
*.swo
*~

# Project specific
action_execute.sh
ascii.txt
action_execute_dev.sh
ascii.txt

# Dependencies
node_modules/
package-lock.json
yarn.lock

# Local development
*.log
.coverage
coverage/
htmlcov/
.pytest_cache/
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
<!-- Determine analytics provider -->
{% if config.extra.analytics %}
{% set provider = config.extra.analytics.provider %}
{% endif %}
<!-- Set up analytics provider -->
{% if provider %}
{% include "partials/integrations/analytics/" ~ provider ~ ".html" %}
{% if config.extra.consent %}
<script>
// Initialize Matomo's _paq array
window._paq = window._paq || [];
window._paq.push(['requireCookieConsent']);
// Check initial consent and load analytics
var consent = __md_get("__consent");
if (consent && consent.analytics) {
console.log(`We have analytics liftoff. Value of consent, ${consent.analytics}`);
window._paq.push(['rememberCookieConsentGiven']); // Remember consent
__md_analytics(); // Load Matomo if consent is given
}
else if (!consent) { // Load consent popup
console.log('It looks like you have not explicitly consented to analytics. Let us fix that.')
window.location.href = "#__consent";
}
else if (consent && !consent.analytics) {
console.log(`The launch of our analytics rocket is postponed. Value of consent, ${consent.analytics}`)
}
// Monitor local storage for changes in consent
window.addEventListener("storage", function (event) {
if (event.key === "__consent") {
var updatedConsent = __md_get("__consent");
if (updatedConsent && updatedConsent.analytics) {
// Consent granted
window._paq.push(['rememberCookieConsentGiven']);
__md_analytics();
__md_feedback();
} else {
// Consent revoked or not set
window._paq.push(['forgetCookieConsentGiven']);
console.log(`Analytics consent revoked. Consent value = ${updatedConsent.analytics}. Analytics disabled.`);
}
}
});
</script>
{% endif %}
{% endif %}
<!-- Determine analytics provider -->
{% if config.extra.analytics %}
{% set provider = config.extra.analytics.provider %}
{% endif %}

<!-- Set up analytics provider -->
{% if provider %}
{% include "partials/integrations/analytics/" ~ provider ~ ".html" %}

{% if config.extra.consent %}
<script>
// Initialize Matomo's _paq array
window._paq = window._paq || [];
window._paq.push(['requireCookieConsent']);

// Check initial consent and load analytics
var consent = __md_get("__consent");

if (consent && consent.analytics) {
console.log(`We have analytics liftoff. Value of consent, ${consent.analytics}`);
window._paq.push(['rememberCookieConsentGiven']); // Remember consent
__md_analytics(); // Load Matomo if consent is given
}
else if (!consent) { // Load consent popup
console.log('It looks like you have not explicitly consented to analytics. Let us fix that.')
window.location.href = "#__consent";
}
else if (consent && !consent.analytics) {
console.log(`The launch of our analytics rocket is postponed. Value of consent, ${consent.analytics}`)
}

// Monitor local storage for changes in consent
window.addEventListener("storage", function (event) {
if (event.key === "__consent") {
var updatedConsent = __md_get("__consent");

if (updatedConsent && updatedConsent.analytics) {
// Consent granted
window._paq.push(['rememberCookieConsentGiven']);
__md_analytics();
__md_feedback();
} else {
// Consent revoked or not set
window._paq.push(['forgetCookieConsentGiven']);
console.log(`Analytics consent revoked. Consent value = ${updatedConsent.analytics}. Analytics disabled.`);
}
}
});
</script>
{% endif %}
{% endif %}
1 change: 0 additions & 1 deletion mkdocs.yml → mkdocs.yml.bak
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,3 @@ nav:
- API.md
- Walkthroughs:
- blog/index.md

Loading