Skip to content

Commit f1660d6

Browse files
committed
Add aws upload
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
1 parent a6f81a5 commit f1660d6

File tree

2 files changed

+87
-9
lines changed

2 files changed

+87
-9
lines changed

.github/workflows/nightly-upload.yml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
include:
20-
# - ubuntu_distribution: focal
21-
# gazebo_distribution: citadel
22-
#
20+
- ubuntu_distribution: focal
21+
gazebo_distribution: citadel
22+
2323
- ubuntu_distribution: focal
2424
gazebo_distribution: fortress
2525

@@ -54,17 +54,39 @@ jobs:
5454
name: api-docs-${{ matrix.gazebo_distribution }}
5555
path: ws/build/**/doxygen/html
5656

57-
deploy:
58-
needs: build
57+
upload:
58+
name: Upload docs to production
5959
runs-on: ubuntu-latest
60-
name: Deploy
60+
permissions:
61+
id-token: write
62+
contents: read
6163
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
- name: Configure AWS Credentials
67+
id: creds
68+
uses: aws-actions/configure-aws-credentials@v4
69+
with:
70+
aws-region: us-east-1
71+
role-to-assume: arn:aws:iam::200670743174:role/github-oidc-deployment-gz-web-app
6272
- uses: actions/download-artifact@v4
6373
with:
64-
path: api-docs
74+
path: .api-docs
6575
pattern: api-docs-*
6676
merge-multiple: true
77+
- name: 'Restructure API Docs'
78+
run: python3 tools/restructure_doxygen_artifacts.py .api-docs .api-out
6779
- uses: actions/upload-artifact@v4
6880
with:
69-
name: api-docs-merged
70-
path: .
81+
name: api-docs
82+
path: .api-out/*
83+
- name: Run nightly upload
84+
run: aws s3 sync --dry-run .api-out/ s3://gazebosim.org/api/
85+
shell: bash
86+
env:
87+
AWS_ACCESS_KEY_ID: ${{ steps.creds.outputs.aws-access-key-id }}
88+
AWS_SECRET_ACCESS_KEY: ${{ steps.creds.outputs.aws-secret-access-key }}
89+
AWS_SESSION_TOKEN: ${{ steps.creds.outputs.aws-session-token }}
90+
- name: Invalidate Cloudfront distribution
91+
run: |
92+
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths '/*' --region us-east-1
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Usage
2+
# /restructure_doxygen_artifacts.py <path_to_artifacts> <output_directory>
3+
#
4+
# Given a directory containing merged doxygen build artifacts, this script reorganizes them so they
5+
# can be deployed to the website
6+
# This assumes the following directory structure:
7+
# ignition-utils1
8+
# doxygen
9+
# html
10+
# gz-utils2
11+
# doxygen
12+
# html
13+
# ignition-math6
14+
# doxygen
15+
# html
16+
# gz-math7
17+
# doxygen
18+
# html
19+
# ...
20+
#
21+
# The result should look like
22+
# utils
23+
# 1 (content of ignition-utils1/doxygen/html)
24+
# 2 (content of gz-utils2/doxygen/html)
25+
# math
26+
# 6 (content of ignition-math6/doxygen/html)
27+
# 7 (content of gz-math7/doxygen/html)
28+
29+
import re
30+
import sys
31+
import pathlib
32+
import shutil
33+
34+
input_dir = pathlib.Path(sys.argv[1])
35+
output_dir = pathlib.Path(sys.argv[2])
36+
output_dir.mkdir(exist_ok=True)
37+
38+
re_expr = R"(ignition|gz)-([a-z_]*)(\d*)"
39+
40+
41+
def copy_library(lib_html, lib_name, lib_version):
42+
output_lib_dir = output_dir / lib_name / lib_version
43+
output_lib_dir.mkdir(exist_ok=True, parents=True)
44+
print(f"{lib_html} -> {output_lib_dir}")
45+
shutil.copytree(lib_html, output_lib_dir, dirs_exist_ok=True)
46+
47+
48+
for lib in input_dir.iterdir():
49+
m = re.match(re_expr, lib.name)
50+
if m:
51+
_, lib_name, lib_version = m.groups()
52+
lib_html = lib/"doxygen"/"html"
53+
copy_library(lib_html, lib_name, lib_version)
54+
# Handle gazebo->sim rename by making a copy into the sim directory
55+
if lib_name == "gazebo":
56+
copy_library(lib_html, "sim", lib_version)

0 commit comments

Comments
 (0)