85 lines
2.4 KiB
YAML
85 lines
2.4 KiB
YAML
name: Build Docs
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
# Set job outputs to values from filter step
|
|
outputs:
|
|
docs: ${{ steps.filter.outputs.docs }}
|
|
steps:
|
|
- name: Base requirements
|
|
run: |
|
|
apk update && apk add --no-cache nodejs
|
|
- uses: actions/checkout@v4
|
|
# For pull requests it's not necessary to checkout the code but for the main branch it is
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
docs:
|
|
- README.md
|
|
- docs/**
|
|
- requirements-docs.txt
|
|
- pyproject.toml
|
|
- mkdocs.yml
|
|
- Dockerfile.docs-site
|
|
- docker-compose.docs-site.yml
|
|
- .gitea/workflows/build-docs.yml
|
|
- .gitea/workflows/deploy-docs.yml
|
|
|
|
build-docs:
|
|
needs:
|
|
- changes
|
|
if: ${{ needs.changes.outputs.docs == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Base requirements
|
|
run: |
|
|
apk update && apk add --no-cache nodejs
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
- name: Setup uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
version: "0.6.3"
|
|
enable-cache: true
|
|
cache-dependency-glob: |
|
|
requirements**.txt
|
|
pyproject.toml
|
|
- name: Install docs extras
|
|
run: uv pip install -r requirements-docs.txt
|
|
- name: Build Docs
|
|
run: mkdocs build
|
|
- name: Build Docker Image
|
|
run: |
|
|
docker build -f Dockerfile.docs-site -t registry.botforge.biz/${{ vars.STACK_NAME }} .
|
|
docker tag ${{ vars.STACK_NAME }}:latest registry.botforge.biz/${{ vars.STACK_NAME }}
|
|
docker login registry.botforge.biz -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.REGISTRY_PASSWORD }}
|
|
docker push registry.botforge.biz/${{ vars.STACK_NAME }}
|
|
|
|
deploy-docs:
|
|
needs:
|
|
- build-docs
|
|
runs-on: staging
|
|
env:
|
|
STACK_NAME: ${{ vars.STACK_NAME }}
|
|
DOMAIN: ${{ vars.DOMAIN }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Copy to working directory
|
|
run: |
|
|
mkdir -p ~/${{ vars.STACK_NAME }}
|
|
cp docker-compose.docs-site.yml ~/${{ vars.STACK_NAME }}/docker-compose.yml
|
|
- name: Start Docs Site
|
|
run: |
|
|
cd ~/${{ vars.STACK_NAME }}
|
|
docker-compose up -d
|
|
|