-
Notifications
You must be signed in to change notification settings - Fork 16
135 lines (122 loc) · 3.94 KB
/
gh-pages.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
name: GitHub Pages
on: [push, pull_request]
jobs:
deploy:
name: Deploy GitHub Pages
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write # To create a PR from that branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Service containers to run
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:14
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
kroki:
image: yuzutech/kroki
env:
KROKI_BLOCKDIAG_HOST: blockdiag
KROKI_MERMAID_HOST: mermaid
KROKI_BPMN_HOST: bpmn
KROKI_EXCALIDRAW_HOST: excalidraw
KROKI_SAFE_MODE: unsafe
KROKI_MAX_URI_LENGTH: 64000
ports:
- "7123:8000"
blockdiag:
image: yuzutech/kroki-blockdiag
ports:
- "8001:8001"
mermaid:
image: yuzutech/kroki-mermaid
ports:
- "8002:8002"
bpmn:
image: yuzutech/kroki-bpmn
ports:
- "8003:8003"
excalidraw:
image: yuzutech/kroki-excalidraw
ports:
- "8004:8004"
steps:
- name: Checkout The Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set env
run: |
GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
echo "PGHOST=postgres" >> $GITHUB_ENV
echo "PGPASSWORD=postgres" >> $GITHUB_ENV
# Try and free space for the runner
rm -rf /opt/hostedtoolcache
- name: Build Docs
uses: docker://ghcr.io/input-output-hk/catalyst-gh-tools:v1.4.4
with:
driver-opts: network=host
entrypoint: cargo
args: make build-docs -U postgres
# On PUSH or PR we deploy docs to a sub-directory named after the branch.
# This lets us review the docs as rendered, and not just the markdown.
- name: Deploy Docs
id: deployAttempt
continue-on-error: true
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/html
destination_dir: ${{ env.GIT_BRANCH }}
# This might fail if we try and deploy multiple pages at once.
# So, check if it did, and retry.
# Retry #1
- name: Delay On Failure To Deploy
id: deployRetryWait1
if: steps.deployAttempt.outcome == 'failure'
run: |
sleep $[ ( $RANDOM % 10 ) + 1 ]s
shell: bash
- name: Deploy Docs
id: deployRetry1
if: steps.deployAttempt.outcome == 'failure'
continue-on-error: true
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/html
destination_dir: ${{ env.GIT_BRANCH }}
# Retry #2
- name: Delay On Failure To Deploy
id: deployRetryWait2
if: steps.deployRetry1.outcome == 'failure'
run: |
sleep $[ ( $RANDOM % 10 ) + 1 ]s
shell: bash
- name: Deploy Docs
id: deployRetry2
if: steps.deployRetry1.outcome == 'failure'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./book/html
destination_dir: ${{ env.GIT_BRANCH }}
- name: Stop containers
if: always()
run: docker-compose -f "utilities/kroki-service/docker-compose.yml" down