meow
Some checks failed
/ build (push) Failing after 22s
/ Ansible Lint (push) Has been cancelled

This commit is contained in:
June 2026-05-18 21:38:37 +02:00
commit a154927b07
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0
4 changed files with 123 additions and 0 deletions

View file

@ -0,0 +1,24 @@
on:
pull_request:
types:
- closed
jobs:
cleanup-staging:
runs-on: docker
container:
image: code.forgejo.org/oci/node:22-bookworm
steps:
- name: Pipeline info PR
run: |
echo "Run triggered by ${{ github.event_name }} (${{ github.event.action }}) on ref ${{ github.ref_name }}"
- name: Staging Deployment - Prepare keys
run: |
echo "${{ secrets.SSH_DEPLOY_KEY }}" > deploykey.priv
chmod 400 deploykey.priv
echo "${{ vars.SSH_KNOWN_HOSTS }}" > ./known_hosts
- name: Staging Deployment - Remove PR from staging
run: |
ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts' infra-docs-deploy@public-web-static.hosts.hamburg.ccc.de -t "rm -r /var/www/staging.infra-docs.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/"

View file

@ -0,0 +1,78 @@
on:
push:
branches:
- main
- docs_site
pull_request:
env:
TZ: Europe/Berlin
jobs:
build:
runs-on: docker
container:
image: docker.io/library/python:3.14-trixie
steps:
- name: Pipeline info
run: |
echo "Run triggered by ${{ github.event_name }} (${{ github.event.action }}) on ref ${{ github.ref_name }}"
- name: Install packages
run: |
apt update
apt -y install nodejs git rsync openssh-client
pip install --upgrade pip
- uses: actions/checkout@v6
- name: Install Python packages
run: |
cd docs
pip install -r requirements.txt
- name: Build website - prod
if: github.event_name != 'pull_request'
run: |
cd docs
mkdocs build
- name: Build website - staging
if: github.event_name == 'pull_request'
run: |
cd docs
sed -i "s#site_url: 'https://infra-docs.hamburg.ccc.de'#site_url: 'https://staging.infra-docs.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/'#" mkdocs.yaml
mkdocs build
- name: Deploy - Prepare keys
run: |
echo "${{ secrets.SSH_DEPLOY_KEY }}" > deploykey.priv
chmod 400 deploykey.priv
echo "${{ vars.SSH_KNOWN_HOSTS }}" > ./known_hosts
- name: Deploy - Upload PR to staging
if: github.event_name == 'pull_request'
run: |
echo "Deploying to staging.infra-docs.hamburg.ccc.de/pr${{ github.event.pull_request.number }}"
rsync -v -r --delete -e "ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts'" docs/site/ infra-docs-deploy@public-web-static.hosts.hamburg.ccc.de:/var/www/staging.infra-docs.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/
- name: Deploy - Add comment to PR with staging URL
if: github.event_name == 'pull_request' && github.event.action == 'opened'
run: |
curl \
-X POST \
${{ github.event.pull_request.base.repo.url }}/issues/${{ github.event.pull_request.number }}/comments \
-H "Content-Type: application/json" \
-H "Authorization: token $FORGEJO_TOKEN" \
--data '{ "body": "You can view your changes at https://staging.infra-docs.hamburg.ccc.de/pr${{ github.event.pull_request.number }}/" }'
- name: Deploy - Upload to prod
if: github.event_name != 'pull_request'
run: |
rsync -v -r --delete -e "ssh -i deploykey.priv -o 'UserKnownHostsFile ./known_hosts'" docs/site/ infra-docs-deploy@public-web-static.hosts.hamburg.ccc.de:/var/www/infra-docs.hamburg.ccc.de/
- uses: actions/upload-artifact@v3
if: github.event_name == 'pull_request'
with:
name: website-build
path: docs/site/

19
docs/mkdocs.yml Normal file
View file

@ -0,0 +1,19 @@
site_name: CCCHH Infrastructure Documentation
site_url: https://infra-docs.hamburg.ccc.de
repo_url: https://git.hamburg.ccc.de/CCCHH/ansible-infra
copyright: MIT
markdown_extensions:
- smarty
- admonition
- attr_list
theme:
name: shadcn
show_title: true
show_stargazers: false
pygments_style:
light: shadcn-light
dark: github-dark
icon: oui:documentation
topbar_sections: false
show_datetime: false

2
docs/requirements.txt Normal file
View file

@ -0,0 +1,2 @@
mkdocs
mkdocs-shadcn