forked from DLR-AMR/t8code
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (133 loc) · 5.08 KB
/
add_release_documentation.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
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
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: checkout
if: ${{ env.MINOR_RELEASE == 'true' }}
uses: actions/checkout@v4
with:
path: t8code
- 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 }}
fetch-depth: 0
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
mkdir -p doc/$GITHUB_REF_NAME
cp -r ../../t8code/build_debug/doc/html/* doc/$GITHUB_REF_NAME/
cd pages
today=`date +'%Y-%m-%d %H:%M'`
sed -i s/"^Date:.*"/"Date: $today"/g 4_Documentation.md
csplit -z 4_Documentation.md /"t8code dev"/+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
- name: Create Pull Request at DLR-AMR/t8code-website
if: ${{ env.MINOR_RELEASE == 'true' }}
uses: peter-evans/create-pull-request@v5
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