Upload release documentation to website #9
Workflow file for this run
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
name: "Upload release documentation to website" | |
# This file is part of t8code. | |
# t8code is a C library to manage a collection (a forest) of multiple | |
# connected adaptive space-trees of general element types in parallel. | |
# | |
# Copyright (C) 2015 the developers | |
# | |
# t8code is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. | |
# | |
# t8code is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with t8code; if not, write to the Free Software Foundation, Inc., | |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
# | |
# This github CI script runs every time a new release on the main branch is created. | |
# It checks if the release is at least a minor release before running the tasks. | |
# It generates the doxygen documentation of the release and creates a pr to add | |
# the documentation to the t8code website. | |
# This workflow cannot be triggered automatically, because it needs | |
# the tag name of the release. The tag name is not provided if the workflow is | |
# triggered manually. | |
# | |
on: | |
release: | |
types: | |
- created | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
add_release_doc: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
# check if release is at least a minor release | |
- name: check-tag | |
run: | | |
if [[ $GITHUB_REF_NAME =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then | |
echo "MINOR_RELEASE=true" >> $GITHUB_ENV | |
else | |
echo "MINOR_RELEASE=false" >> $GITHUB_ENV | |
fi | |
# | |
# Setup and bootstrap | |
# | |
- name: Update packages | |
run: sudo apt-get update && sudo apt-get upgrade -y | |
# This step is necessary to get the newest package data | |
- name: checkout | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
uses: actions/checkout@v4 | |
with: | |
path: t8code | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Install dependencies | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: sudo apt-get install libz-dev doxygen-latex | |
- name: init submodules | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: | | |
cd t8code | |
git submodule init | |
- name: update submodules | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: | | |
cd t8code | |
git submodule update | |
- name: bootstrap | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: | | |
cd t8code | |
./bootstrap | |
# build config vars | |
- name: build CFLAGS and CXXFLAGS variables | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: echo CFLAGS_var="-Wall -pedantic -O3" >> $GITHUB_ENV | |
&& echo CXXFLAGS_var="-Wall -pedantic -O3" >> $GITHUB_ENV | |
- name: build config variables | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: export CONFIG_OPTIONS="--without-blas ${LESS_TEST_OPTION}" | |
&& export CONFIG_SERIAL_DEBUG="$CONFIG_OPTIONS --enable-debug --with-sc=$SC_SERIAL_DEBUG/install --with-p4est=$P4EST_SERIAL_DEBUG/install" | |
- name: Check vars | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: echo "[$CONFIG_SERIAL_DEBUG]" | |
# configure and generate doxygen | |
- name: check debugging mode | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: echo "Checking debug mode" | |
- name: configure | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: | | |
cd t8code | |
mkdir build_debug && cd build_debug && ../configure $CONFIG_SERIAL_DEBUG CFLAGS="$CFLAGS_var" CXXFLAGS="$CXXFLAGS_var" | |
- name: make doxygen | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: | | |
cd t8code/build_debug | |
make doxygen | |
# upload documentation | |
- name: Checkout t8code-website repo | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
repository: DLR-AMR/t8code-website | |
path: t8code-website | |
token: ${{ secrets.T8DDY_TOKEN }} | |
- name: Add documentation to website | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
run: | | |
cd t8code-website/content | |
# Generate new folder for the newest documentation and copy documentation | |
mkdir -p doc/$GITHUB_REF_NAME | |
cp -r ../../t8code/build_debug/doc/html/* doc/$GITHUB_REF_NAME/ | |
# Add a link to the newest documentation in the documentation webpage | |
cd pages | |
today=`date +'%Y-%m-%d %H:%M'` | |
sed -i s/"^Date:.*"/"Date: $today"/g 4_Documentation.md | |
# Split documentation webpage after t8code latest and append newest documentation | |
csplit -z 4_Documentation.md /"t8code latest"/+1 | |
mv xx00 4_Documentation.md | |
echo " - [t8code $GITHUB_REF_NAME](../doc/$GITHUB_REF_NAME/index.html)" >> 4_Documentation.md | |
cat xx01 >> 4_Documentation.md | |
rm xx01 | |
# Refresh redirect to t8code latest | |
cd ../doc | |
echo '<meta http-equiv="refresh" content="0; URL=$GITHUB_REF_NAME/index.html" />' > latest.html | |
# Refresh redirections for complete latest documentation | |
./generate_redirections.sh $GITHUB_REF_NAME | |
- name: Create Pull Request at DLR-AMR/t8code-website | |
if: ${{ env.MINOR_RELEASE == 'true' }} | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
path: t8code-website | |
title: Add documentation for t8code ${{ github.ref_name }} | |
body: There has been a new release over at DLR-AMR/t8code. We should add the latest documentation to our website. | |
branch: add-t8code-${{ github.ref_name }}-documentation | |
commit-message: add documentation for t8code ${{ github.ref_name }} | |
token: ${{ secrets.T8DDY_TOKEN }} | |
delete-branch: true |