-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (90 loc) · 3.4 KB
/
docs-deploy.yml
File metadata and controls
101 lines (90 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Deploy Documentation (Bazel) to Netcup
# Bazel-native workflow for building and deploying documentation site
on:
push:
branches:
- main
paths:
- "docs-site/**"
workflow_dispatch:
inputs:
force_deploy:
description: "Force deployment even if no docs-site changes"
required: false
default: "false"
jobs:
bazel-build-and-deploy:
runs-on: ubuntu-latest
# Only run on main branch to prevent accidental deployments
if: github.ref == 'refs/heads/main'
env:
NETCUP_URI: ${{ secrets.NETCUP_URI }}
NETCUP_USER: ${{ secrets.NETCUP_USER }}
NETCUP_PASSWORD: ${{ secrets.NETCUP_PASSWORD }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
- name: Build and validate documentation site
run: |
# Run comprehensive validation and build
echo "🧪 Running documentation validation tests..."
bazel test //docs-site:docs_tests
echo "📦 Building deployment bundle..."
bazel build //docs-site:deployment_bundle
# Extract deployment bundle for FTP upload
echo "📂 Extracting deployment bundle..."
mkdir -p deployment_temp
cd deployment_temp
tar -xzf ../bazel-bin/docs-site/docs_deployment.tar.gz
# Verify deployment content
echo "✅ Verifying deployment content..."
ls -la .
echo "📄 Documentation site preview:"
head -5 index.html | grep -E "(title|h1)" || echo "Basic HTML structure verified"
# Check file size (should be reasonable)
SIZE=$(wc -c < index.html)
echo "📊 Site size: ${SIZE} bytes"
if [ $SIZE -lt 1000 ]; then
echo "❌ Warning: Site seems too small"
exit 1
elif [ $SIZE -gt 100000 ]; then
echo "❌ Warning: Site seems too large"
exit 1
else
echo "✅ Site size is reasonable"
fi
- name: Deploy to Netcup hosting
# Only deploy if secrets are available
if: env.NETCUP_URI != '' && env.NETCUP_USER != '' && env.NETCUP_PASSWORD != ''
uses: SamKirkland/FTP-Deploy-Action@v4.3.6
with:
server: ${{ env.NETCUP_URI }}
username: ${{ env.NETCUP_USER }}
password: ${{ env.NETCUP_PASSWORD }}
local-dir: ./deployment_temp/
server-dir: /
exclude: |
**/.git*
**/.git*/**
**/node_modules/**
**/.DS_Store
**/Thumbs.db
- name: Skip deployment (secrets not configured)
if: env.NETCUP_URI == '' || env.NETCUP_USER == '' || env.NETCUP_PASSWORD == ''
run: |
echo "⚠️ Skipping deployment - Netcup secrets not configured"
echo "📦 Bazel build completed successfully, but deployment requires secrets"
- name: Purge Cloudflare cache (optional)
if: env.CLOUDFLARE_ZONE_ID != ''
uses: jakejarvis/cloudflare-purge-action@master
with:
zone: ${{ env.CLOUDFLARE_ZONE_ID }}
token: ${{ env.CLOUDFLARE_TOKEN }}