-
Notifications
You must be signed in to change notification settings - Fork 158
147 lines (129 loc) · 5.23 KB
/
github-pages.yml
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
# github-pages.yml/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:34 PM
name: Jekyll Build and Deploy
on:
push:
branches: [main, develop]
workflow_dispatch:
jobs:
check:
name: Check modified files for Python SDK changes
runs-on: ubuntu-latest
outputs:
run_job: ${{ steps.check_files.outputs.run_job }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Analyze modified files
id: check_files
run: |
echo "=============== list modified files ==============="
git diff --name-only HEAD^ HEAD
echo
git diff --name-only HEAD^ HEAD >files.txt
while IFS= read -r file; do
if [[ $file != demos/python/sdk_wireless_camera_control* ]]; then
echo "::set-output name=run_job::false"
else
echo "Found a Python SDK modified file"
echo "::set-output name=run_job::true"
break
fi
done <files.txt
python_sdk:
name: Build and Deploy Python SDK
needs: check
if: needs.check.outputs.run_job == 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
include:
- os: ubuntu-latest
path: ~/Library/Caches/pip
steps:
- name: Checkout source branch (the PR branch)
uses: actions/checkout@v3
with:
path: source
- name: Install Dot to build Sphinx Diagrams
shell: bash
run: sudo apt-get update && sudo apt install -y graphviz
- name: Set up Python 3.11.4
uses: actions/setup-python@v2
with:
python-version: 3.11.4
- name: Restore cached pip environment
uses: actions/cache@v2
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-3.9.10-pip-${{ hashFiles('demos/python/sdk_wireless_camera_control/poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
working-directory: ./source/demos/python/sdk_wireless_camera_control/
run: |
python -m pip install --upgrade pip wheel
pip install nox==2023.4.22
pip install nox-poetry==1.0.3
pip install poetry
- name: Build Sphinx Documentation
working-directory: ./source/demos/python/sdk_wireless_camera_control/
run: nox -s docs
- name: Checkout target branch (the gh-pages branch)
uses: actions/checkout@v3
with:
ref: gh-pages
path: target
- name: Deploy to Github Pages
run: |
rm -rf ./target/python_sdk
mkdir -p ./target/python_sdk
cp -r ./source/demos/python/sdk_wireless_camera_control/docs/build/. ./target/python_sdk
cd ./target/python_sdk
git add .
git config user.name github-actions
git config user.email github-actions@github.com
git commit --allow-empty -m "sphinx build from Action ${GITHUB_SHA}"
git push
jekyll:
name: Build and Deploy Jekyll Site
needs: [check, python_sdk]
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout source branch (the PR branch)
uses: actions/checkout@v3
with:
path: source
- name: Checkout target branch (the gh-pages branch)
uses: actions/checkout@v3
with:
ref: gh-pages
path: target
- name: Log in to the Container registry
uses: docker/login-action@v1.10.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Github Pages
shell: bash
working-directory: ./source
run: |
if [[ ${{ github.repository }} == gopro/OpenGoPro ]]; then
make build
else
make build BUILD_HOST_URL=${{ secrets.STAGING_GH_PAGES_SITE }} BUILD_BASE_URL="\'\'"
fi
- name: Deploy to Github Pages
run: |
cp -r ./source/docs/_site/* ./target
cd ./target
git add .
git config user.name github-actions
git config user.email github-actions@github.com
git commit --allow-empty -m "Github Pages build from Action ${GITHUB_SHA}"
git push