-
Notifications
You must be signed in to change notification settings - Fork 8
90 lines (75 loc) · 3 KB
/
Copy pathasciidoc-build.yml
File metadata and controls
90 lines (75 loc) · 3 KB
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
name: AsciiDoc Documentation Build
on:
create: # new branches or tags
release: # new releases
pull_request:
branches: [ master ]
push: # on push. This may be removed later
schedule: # periodic - needed because some of the content is from the other repos
- cron: '30 5,20 * * *' # this is pretty often. Only needed during review phase
jobs:
asciidoctor-build:
name: Run Asciidoctor on Documentation
runs-on: ubuntu-18.04
steps:
# Checkout osi documentation
- name: Checkout osi-documentation
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
# Checkout all other OSI repositories with branch "migration" and nested into osi-documentation
- name: Checkout open-simulation-interface
uses: actions/checkout@v2
with:
repository: OpenSimulationInterface/open-simulation-interface
path: open-simulation-interface
fetch-depth: 0
- name: Checkout OSI Simulation Model Packaging
uses: actions/checkout@v2
with:
repository: OpenSimulationInterface/osi-simulation-model-packaging
path: osi-simulation-model-packaging
- name: Checkout proto2cpp
uses: actions/checkout@v2
with:
repository: OpenSimulationInterface/proto2cpp
path: proto2cpp
# Versioning
- name: Get versioning
id: get_version
working-directory: open-simulation-interface
run: echo ::set-output name=VERSION::$(git describe --always)
- name: Apply versioning to Adoc
uses: jacobtomlinson/gha-find-replace@master
with:
find: ":revnumber: --localbuild--"
replace: ":revnumber: master (${{ steps.get_version.outputs.VERSION }})"
include: "index.adoc"
- name: Remove docdate for online hosted document
run: sed 's/^:revdate:.*/:!revdate:/' index.adoc
# run Asciidoctor
- name: Build HTML
uses: avattathil/asciidoctor-action@master
with:
program: "asciidoctor -D . --failure-level WARN -r asciidoctor-diagram -r asciidoctor-bibtex -a mathjax --trace --backend=html5 index.adoc -o open-simulation-interface_V${{ steps.get_version.outputs.VERSION }}.html"
# Upload artifact.
- name: Upload HTML Artifact
uses: actions/upload-artifact@v2
if: ${{ github.event_name == 'pull_request' }}
with:
name: HTML document
path: open-simulation-interface_V${{ steps.get_version.outputs.VERSION }}.html
if-no-files-found: error
# Publish the artifact when pipeline runs on master
- name: rename file for deploy to gh-page
if: ${{ github.ref == 'refs/heads/master' }}
run: |
mkdir html/
cp open-simulation-interface_V${{ steps.get_version.outputs.VERSION }}.html html/index.html
- name: deploy to gh-pages if push to master branch
if: ${{ github.ref == 'refs/heads/master' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./html