-
Notifications
You must be signed in to change notification settings - Fork 5
80 lines (67 loc) · 2.34 KB
/
build_and_deploy_docs.yaml
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
# This workflow is triggered on any PR's changes
name: Build and deploy docs to Github Pages
on:
push:
branches:
- bugfix/FAIRSPC-87
jobs:
build-saturn:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Log details
run: |
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "Triggered on branch: $BRANCH"
- name: Set up Ruby (required for gem installation)
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
- name: Install Asciidoctor to build docs
run: |
gem install asciidoctor
gem install asciidoctor-pdf
gem install rouge
- name: Build Docs - Collect needed files
run: |
PROJECT_FILES=(
"projects/saturn/src/main/resources/log4j2.properties"
"projects/saturn/src/main/resources/system-vocabulary.ttl"
"projects/saturn/taxonomies.ttl"
"projects/saturn/views.yaml"
"projects/saturn/vocabulary.ttl"
)
BUILD_DIR=./docs/build
version=$(cat VERSION)
mkdir -p $BUILD_DIR/docs
cp ./README.adoc $BUILD_DIR
sed -i -e "s/VERSION/${version}/" $BUILD_DIR/README.adoc
cp -r ./docs/images $BUILD_DIR/docs/
for f in ${PROJECT_FILES[*]}; do
mkdir -p "$BUILD_DIR/$(dirname "$f")"
cp "$f" "$BUILD_DIR/"$(dirname "$f")""
done
- name: Build Docs - Generate PDF and HTML
run: |
BUILD_DIR=./docs/build
asciidoctor-pdf -a pdf-theme=./docs/pdf-theme.yml -o $BUILD_DIR/Fairspace.pdf $BUILD_DIR/README.adoc || {
echo "Error building PDF"
popd
exit 1
}
asciidoctor -a toc=left -D $BUILD_DIR/ -o index.html $BUILD_DIR/README.adoc || {
echo "Error building site"
popd
exit 1
}
rm $BUILD_DIR/README.adoc
rm $BUILD_DIR/README.adoc-e
ls -R $BUILD_DIR
#
# - name: Run Deploy Docs script
# env:
# CI_SERVICE_ACCOUNT_USER: ${{ secrets.CI_SERVICE_ACCOUNT_USER }}
# CI_SERVICE_ACCOUNT_PASSWORD: ${{ secrets.FNS_PAT }}
# DOCUMENTATION_REPO: ${{ vars.DOCUMENTATION_REPO }}
# run: ./docs/scripts/deploy.sh