-
Notifications
You must be signed in to change notification settings - Fork 2.5k
139 lines (114 loc) · 4.34 KB
/
Copy pathdocs.yml
File metadata and controls
139 lines (114 loc) · 4.34 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Docs Build and Deploy
on:
push:
branches:
- main
paths:
- ".github/workflows/docs.yml"
- "scripts/deploy_root_files.sh"
- "requirements-docs.txt"
- "mkdocs.yml"
- "docs/**"
pull_request:
branches:
- main
paths:
- ".github/workflows/docs.yml"
- "scripts/deploy_root_files.sh"
- "requirements-docs.txt"
- "mkdocs.yml"
- "docs/**"
release:
types:
- published
workflow_dispatch:
inputs:
version:
description: 'Version to deploy to (e.g., v1.0.0)'
required: true
default: 'dev'
jobs:
build_and_deploy:
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
if: github.repository == 'a2aproject/A2A'
steps:
- name: Checkout Code
uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Configure Git Credentials
run: |
git config --global user.name github-actions[bot]
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install documentation dependencies
run: uv pip install --system --upgrade -r requirements-docs.txt
- name: Setup Buf
uses: bufbuild/buf-setup-action@v1
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Install build tools
run: |
# Install protoc
PROTOC_VERSION="28.3"
PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-x86_64.zip"
curl -fsSL -o /tmp/protoc.zip "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"
sudo unzip -q /tmp/protoc.zip -d /usr/local
rm /tmp/protoc.zip
# Install protoc-gen-jsonschema
go install github.com/bufbuild/protoschema-plugins/cmd/protoc-gen-jsonschema@latest
sudo cp "$(go env GOPATH)/bin/protoc-gen-jsonschema" /usr/local/bin/
# Clone googleapis
mkdir -p third_party
cd third_party
git clone --depth 1 https://github.com/googleapis/googleapis.git
cd ..
- name: Generate protocol specification files
run: ./scripts/build_docs.sh
- name: Generate consolidated llms-full.txt file
run: bash scripts/build_llms_full.sh
- name: Build Documentation (PR Check)
if: github.event_name == 'pull_request'
run: mkdocs build
- name: Deploy development version from main branch
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
mike deploy --push --update-aliases dev latest
echo "Setting 'latest' as the default version for the site..."
mike set-default --push latest
# Deploy 404 page
bash scripts/deploy_root_files.sh ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }}
- name: Deploy new release version and set as latest
if: github.event_name == 'release'
run: |
# The release tag (e.g., v0.2.2) is used as the version number
export MIKE_VERSION=${GITHUB_EVENT_RELEASE_TAG_NAME}
echo "Deploying docs for version $MIKE_VERSION and setting it as 'latest'..."
mike deploy --push --update-aliases $MIKE_VERSION latest
echo "Setting 'latest' as the default version for the site..."
mike set-default --push latest
# Call the reusable script to deploy the 404 page, passing the token
bash scripts/deploy_root_files.sh ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
- name: Manually deploy specific version from main
if: github.event_name == 'workflow_dispatch'
run: |
mike deploy --push --update-aliases ${{ github.event.inputs.version }} latest
echo "Setting 'latest' as the default version for the site..."
mike set-default --push latest
# Re-deploy 404 page
bash scripts/deploy_root_files.sh ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }}