Files
api-company/.gitea/workflows/build-docs.yaml
T

100 lines
3.5 KiB
YAML

# Gitea Actions: Aggregate openapi.yaml specs + trigger docs-site build
# Closes leeworks-agents/api-company#10
name: Build Docs Site
on:
push:
branches: [main]
workflow_dispatch:
schedule:
# Re-build daily at 02:00 UTC to pick up spec changes
- cron: '0 2 * * *'
jobs:
aggregate-specs:
name: Aggregate OpenAPI Specs
runs-on: ubuntu-latest
steps:
- name: Checkout api-company
uses: actions/checkout@v4
with:
path: api-company
# NOTE: cross-repo checkouts use SIBLING_REPOS_TOKEN, NOT the auto-injected
# GITEA_TOKEN. Gitea's automatic GITEA_TOKEN is scoped to THIS repo only,
# so checking out other repos fails with
# "Determining the default branch → not found". GITEA_TOKEN is also a
# reserved secret name that cannot be overridden, hence a separate secret.
# SIBLING_REPOS_TOKEN must be a PAT with read access to the API repos.
- name: Checkout zip-enrichment
uses: actions/checkout@v4
with:
repository: leeworks-agents/zip-enrichment
token: ${{ secrets.SIBLING_REPOS_TOKEN }}
path: zip-enrichment
- name: Checkout holidays
uses: actions/checkout@v4
with:
repository: leeworks-agents/holidays
token: ${{ secrets.SIBLING_REPOS_TOKEN }}
path: holidays
- name: Checkout air-quality
uses: actions/checkout@v4
with:
repository: leeworks-agents/air-quality
token: ${{ secrets.SIBLING_REPOS_TOKEN }}
path: air-quality
- name: Checkout vin-decoder
uses: actions/checkout@v4
with:
repository: leeworks-agents/vin-decoder
token: ${{ secrets.SIBLING_REPOS_TOKEN }}
path: vin-decoder
- name: Copy openapi.yaml specs into docs-site
run: |
mkdir -p api-company/docs-site/public/specs
cp zip-enrichment/openapi.yaml api-company/docs-site/public/specs/zip-enrichment.yaml
cp holidays/openapi.yaml api-company/docs-site/public/specs/holidays.yaml
cp air-quality/openapi.yaml api-company/docs-site/public/specs/air-quality.yaml
cp vin-decoder/openapi.yaml api-company/docs-site/public/specs/vin-decoder.yaml
echo "Specs copied:"
ls -la api-company/docs-site/public/specs/
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install docs-site dependencies
working-directory: api-company/docs-site
run: npm ci
- name: Build docs-site
working-directory: api-company/docs-site
run: npm run build
- name: Log in to container registry
run: |
echo "${{ secrets.GITEA_TOKEN }}" | docker login registry.leeworks.dev \
-u ${{ gitea.actor }} --password-stdin
- name: Build and push docs-site image
working-directory: api-company/docs-site
run: |
IMAGE="registry.leeworks.dev/leeworks-agents/docs-site"
SHA="${{ gitea.sha }}"
docker build -t "$IMAGE:$SHA" -t "$IMAGE:latest" .
docker push "$IMAGE:$SHA"
docker push "$IMAGE:latest"
echo "Pushed $IMAGE:$SHA"
- name: Trigger Flux reconcile (optional)
run: |
echo "Image pushed. Flux will detect new tag via image automation and re-deploy docs-site."
echo "If image automation is not configured, manually run: flux reconcile helmrelease docs-site -n docs-site"