mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-22 07:08:53 +01:00
update main_index upon a release
This commit is contained in:
46
.github/workflows/build_documentation.yml
vendored
46
.github/workflows/build_documentation.yml
vendored
@@ -3,7 +3,9 @@ name: Build and upload Documentation
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push: # Only for Testing change later
|
push: # Only for Testing change later
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
env:
|
env:
|
||||||
BUILD_TYPE: RELEASE
|
BUILD_TYPE: RELEASE
|
||||||
@@ -31,6 +33,23 @@ jobs:
|
|||||||
fetch-depth: 0 # Fetch all history for proper git operations
|
fetch-depth: 0 # Fetch all history for proper git operations
|
||||||
token: ${{ secrets.GITHUB_TOKEN }} # Use the default token
|
token: ${{ secrets.GITHUB_TOKEN }} # Use the default token
|
||||||
|
|
||||||
|
# Extract release version (if triggered by release)
|
||||||
|
- name: Get Release Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" == "release" ]; then
|
||||||
|
# Remove 'v' prefix if present (e.g., v10.0.0 -> 10.0.0)
|
||||||
|
VERSION="${{ github.event.release.tag_name }}"
|
||||||
|
VERSION="${VERSION#v}"
|
||||||
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
echo "is_release=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Release version: ${VERSION}"
|
||||||
|
else
|
||||||
|
echo "version=developer" >> $GITHUB_OUTPUT
|
||||||
|
echo "is_release=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "Not a release build"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Install System Packages
|
- name: Install System Packages
|
||||||
uses: awalsh128/cache-apt-pkgs-action@latest
|
uses: awalsh128/cache-apt-pkgs-action@latest
|
||||||
with:
|
with:
|
||||||
@@ -42,8 +61,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: 3.12
|
python-version: 3.12
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
|
|
||||||
- name: Install Python Packages
|
- name: Install Python Packages
|
||||||
run: pip install sphinx sphinx_rtd_theme breathe
|
run: pip install sphinx sphinx_rtd_theme breathe pyyaml jinja2
|
||||||
|
|
||||||
|
|
||||||
- name: Build Documentation
|
- name: Build Documentation
|
||||||
@@ -54,10 +74,14 @@ jobs:
|
|||||||
make -j4
|
make -j4
|
||||||
make docs
|
make docs
|
||||||
|
|
||||||
- name: Upload Documentation Artifact
|
# Update main_index if this is a release
|
||||||
uses: actions/upload-pages-artifact@v4
|
- name: Update version index
|
||||||
with:
|
run: |
|
||||||
path: build/docs/html # maybe we need to upload images as well - so one can click on them?
|
if [ "${{ github.event_name }}" == "release" ]; then
|
||||||
|
cd gh-pages
|
||||||
|
python docs/main_index/render_main_index.py \
|
||||||
|
--version "${{ steps.version.outputs.version }}" \
|
||||||
|
--date "$(date +'%d.%m.%Y')"
|
||||||
|
|
||||||
- name: Checkout gh-pages
|
- name: Checkout gh-pages
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -65,8 +89,12 @@ jobs:
|
|||||||
ref: gh-pages
|
ref: gh-pages
|
||||||
path: gh-pages
|
path: gh-pages
|
||||||
|
|
||||||
- name: Copy documentation to gh-pages # create folder structure
|
- name: Copy documentation to versioned folder
|
||||||
run: cp -r build/docs/html/. gh-pages/
|
run: |
|
||||||
|
VERSION="${{ steps.version.outputs.version }}"
|
||||||
|
mkdir -p "gh-pages/${VERSION}"
|
||||||
|
cp -r build/docs/html/. "gh-pages/${VERSION}/"
|
||||||
|
cp build/docs/main_index/index.html "gh-pages/index.html"
|
||||||
|
|
||||||
- name: Commit and Push changes to gh-pages
|
- name: Commit and Push changes to gh-pages
|
||||||
run: |
|
run: |
|
||||||
@@ -74,7 +102,7 @@ jobs:
|
|||||||
git config --global user.name 'github-actions'
|
git config --global user.name 'github-actions'
|
||||||
git config --global user.email 'github-actions@github.com'
|
git config --global user.email 'github-actions@github.com'
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Update Documentation"
|
git commit -m "Update Documentation for ${{ steps.version.outputs.version }}"
|
||||||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
|
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
|
||||||
git push origin gh-pages
|
git push origin gh-pages
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user