-
Notifications
You must be signed in to change notification settings - Fork 199
150 lines (143 loc) · 5.09 KB
/
docs-build-deploy.yaml
File metadata and controls
150 lines (143 loc) · 5.09 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
140
141
142
143
144
145
146
147
148
149
150
name: 'Docs build and deploy'
on:
pull_request:
paths:
- 'api/**'
- 'docs/**'
- '.github/workflows/docs-build-deploy.yaml'
- 'scripts/static-deploy/**'
push:
branches:
- 'edge'
- 'chore_release*'
tags:
- 'staging-MKDOCS*'
- 'staging-mkdocs*'
- 'MKDOCS*'
- 'mkdocs*'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.ref_name != 'edge' || github.run_id}}-${{ github.ref_type != 'tag' || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
CI: 'true'
# This is the artifact directory as a relative path
# to the working-directory of our tools: scripts/static-deploy
# our script deploy_ci_config.py expects this ENV variable is set
RELATIVE_ARTIFACT_DIR: '../../dist'
jobs:
build-docs:
timeout-minutes: 5
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: read
env:
BRANCH: ${{ github.event.pull_request.head.ref != '' && github.event.pull_request.head.ref || github.ref_name }}
outputs:
artifacts-path: ${{ steps.upload-artifacts.outputs.path }}
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v5
- name: Setup UV
uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
enable-cache: true
cache-dependency-glob: './docs/uv.lock'
- name: Setup Docs Dependencies
working-directory: ./docs
run: make setup
- name: Build Docs
working-directory: ./docs
run: make build
- name: Upload Artifacts
id: upload-artifacts
uses: actions/upload-artifact@v4
with:
name: docs-artifacts
path: |
docs/site/
retention-days: 1
determine-deploy-config:
name: Determine Deployment Configuration
runs-on: ubuntu-24.04
outputs:
application: ${{ steps.deploy-config.outputs.APPLICATION }}
environment: ${{ steps.deploy-config.outputs.ENVIRONMENT }}
sandbox_prefix: ${{ steps.deploy-config.outputs.SANDBOX_PREFIX }}
relative_artifact_dir: ${{ steps.deploy-config.outputs.RELATIVE_ARTIFACT_DIR }}
branch: ${{ steps.config.outputs.branch }}
bucket: ${{ steps.config.outputs.bucket }}
url: ${{ steps.config.outputs.url }}
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- uses: ./.github/actions/git/resolve-tag
- name: Setup UV
uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
enable-cache: true
- name: Setup Deploy Dependencies
working-directory: scripts/static-deploy
run: make setup
- name: Determine Deployment Configuration
id: deploy-config
working-directory: scripts/static-deploy
run: make resolve-ci
deploy-docs:
needs:
- build-docs
- determine-deploy-config
timeout-minutes: 5
runs-on: ubuntu-24.04
if: always() && needs.build-docs.result == 'success' && needs.determine-deploy-config.result == 'success' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
permissions:
id-token: write
contents: read
env:
ENVIRONMENT: ${{ needs.determine-deploy-config.outputs.ENVIRONMENT }}
BRANCH: ${{ needs.determine-deploy-config.outputs.branch }}
BUCKET: ${{ needs.determine-deploy-config.outputs.bucket }}
URL: ${{ needs.determine-deploy-config.outputs.url }}
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- id: resolve-tag
uses: ./.github/actions/git/resolve-tag
- name: Setup UV
uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
enable-cache: true
- name: Setup Deploy Dependencies
working-directory: scripts/static-deploy
run: make setup
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.STATIC_DEPLOYMENT_ROLE }}
aws-region: us-east-2
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: docs-artifacts
path: ./dist # in the default workspace
# RELATIVE_ARTIFACT_DIR is set to ../../dist
# because that is the relative path from scripts/static-deploy
# to the this location
- name: Deploy to S3
working-directory: scripts/static-deploy
run: make deploy \
APPLICATION=${{ needs.determine-deploy-config.outputs.application }} \
ENVIRONMENT=${{ needs.determine-deploy-config.outputs.environment }} \
SANDBOX_PREFIX=${{ needs.determine-deploy-config.outputs.sandbox_prefix }} \
RELATIVE_ARTIFACT_DIR=${{ needs.determine-deploy-config.outputs.relative_artifact_dir }}
- name: Output Deployment URL
run: |
echo "## 🚀 Docs site deployed to ${{ env.ENVIRONMENT }}" >> $GITHUB_STEP_SUMMARY
echo "<${{ env.URL }}>" >> $GITHUB_STEP_SUMMARY