mirror of https://github.com/CGAL/cgal
109 lines
4.0 KiB
YAML
109 lines
4.0 KiB
YAML
name: Documentation
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/github-script@v3
|
|
id: get_round
|
|
with:
|
|
result-encoding: string
|
|
script: |
|
|
const asso = context.payload.comment.author_association
|
|
if(asso == 'OWNER' || asso == 'MEMBER') {
|
|
const body = context.payload.comment.body
|
|
if(body.includes("build:")) {
|
|
return body.replace('build:','')
|
|
}
|
|
}
|
|
return 'stop'
|
|
- uses: actions/github-script@v3
|
|
if: steps.get_round.outputs.result != 'stop'
|
|
id: get_pr_number
|
|
with:
|
|
result-encoding: string
|
|
script: |
|
|
//get pullrequest url
|
|
const pr_number = context.payload.issue.number
|
|
return pr_number
|
|
- uses: actions/github-script@v3
|
|
if: steps.get_round.outputs.result != 'stop'
|
|
id: get_pr_branch
|
|
with:
|
|
result-encoding: string
|
|
script: |
|
|
//get pullrequest url
|
|
const pr_number = context.payload.issue.number
|
|
//get upstream branch
|
|
const pr = await github.pulls.get({
|
|
owner: "CGAL",
|
|
repo: "cgal",
|
|
pull_number: pr_number,
|
|
});
|
|
const result = pr.data.head.label
|
|
return result.replace(/(.*):(.*)/, '$2')
|
|
- uses: actions/checkout@v2
|
|
name: "checkout branch"
|
|
if: steps.get_round.outputs.result != 'stop'
|
|
with:
|
|
repository: CGAL/cgal
|
|
ref: ${{ steps.get_pr_branch.outputs.result }}
|
|
token: ${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}
|
|
|
|
|
|
- name: install dependencies
|
|
if: steps.get_round.outputs.result != 'stop'
|
|
run: |
|
|
set -x
|
|
sudo apt-get install -y graphviz ssh
|
|
sudo pip install lxml pyquery
|
|
wget -O doxygen_exe https://cgal.geometryfactory.com/~mgimeno/doxygen/build_1_8_13/bin/doxygen
|
|
sudo mv doxygen_exe /usr/bin/doxygen
|
|
sudo chmod +x /usr/bin/doxygen
|
|
git config --global user.email "maxime.gimeno@geometryfactory.com"
|
|
git config --global user.name "Maxime Gimeno"
|
|
|
|
- name: configure all
|
|
if: steps.get_round.outputs.result != 'stop'
|
|
run: |
|
|
git clone https://CGAL:${{ secrets.PUSH_TO_CGAL_GITHUB_IO_TOKEN }}@github.com/CGAL/cgal.github.io.git --depth=5
|
|
mkdir -p build_doc && cd build_doc && cmake ../Documentation/doc
|
|
|
|
- name: Upload Doc
|
|
if: steps.get_round.outputs.result != 'stop'
|
|
run: |
|
|
set -e
|
|
PR_NUMBER=${{ steps.get_pr_number.outputs.result }}
|
|
ROUND=${{ steps.get_round.outputs.result }}
|
|
wget cgal.github.io -O tmp.html
|
|
if $(cat tmp.html |egrep -q "\/$PR_NUMBER\/$ROUND"); then
|
|
mkdir -p cgal.github.io/${PR_NUMBER}/$ROUND
|
|
cd build_doc && make -j2 doc && make -j2 doc_with_postprocessing
|
|
cp -r ./doc_output/* ../cgal.github.io/${PR_NUMBER}/$ROUND
|
|
cd ../cgal.github.io
|
|
egrep -v " ${PR_NUMBER}\." index.html > tmp.html
|
|
echo "<li><a href=https://cgal.github.io/${PR_NUMBER}/$ROUND/Manual/index.html>Manual for PR ${PR_NUMBER} ($ROUND).</a></li>" >> ./tmp.html
|
|
mv tmp.html index.html
|
|
git add ${PR_NUMBER}/$ROUND && git commit -a -m "Add ${PR_NUMBER} $ROUND" && git push -u origin master
|
|
else
|
|
exit 1
|
|
fi
|
|
|
|
- name: Post address
|
|
uses: actions/github-script@v3
|
|
if: steps.get_round.outputs.result != 'stop'
|
|
with:
|
|
script: |
|
|
const address = "The documentation is built. You can find it here : https://cgal.github.io/${{ steps.get_pr_number.outputs.result }}/${{ steps.get_round.outputs.result }}/Manual/index.html"
|
|
github.issues.createComment({
|
|
owner: "CGAL",
|
|
repo: "cgal",
|
|
issue_number: pr_number,
|
|
body: address
|
|
});
|