Fix Set Setting URL in the Python SDK (#402) #202
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |