-
Notifications
You must be signed in to change notification settings - Fork 86
149 lines (123 loc) · 5.12 KB
/
doc.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
143
144
145
146
147
148
149
name: Doc
on:
workflow_dispatch:
release:
types: [published]
workflow_call:
jobs:
build:
if: ${{ !((github.event_name == 'release' && github.event.action == 'published') || github.event_name == 'workflow_dispatch') }}
runs-on: ubuntu-22.04
env:
PUPPETEER_CACHE_DIR: ${{ github.workspace }}/node_modules/.chromium
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Cache venv
uses: actions/cache@v3
with:
path: .venv
key: venv_ubuntu22_${{ hashFiles('pdm.lock') }}
- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules_ubuntu22_${{ hashFiles('package-lock.json') }}
- name: Cache coverage
uses: actions/cache@v3
with:
path: .coverage/html
key: coverage_${{ github.run_id }}
- name: Deploy package
run: |
source .venv/bin/activate
pdm run deploy
- name: Get vizzu-lib tag
id: vizzu_tag
run: |
source .venv/bin/activate
vizzu_tag=$(./.venv/bin/python ./tools/ci/get_tag.py)
echo "vizzu_tag=${vizzu_tag}" >> $GITHUB_OUTPUT
- name: Checkout vizzu-lib
uses: actions/checkout@v3
with:
repository: vizzuhq/vizzu-lib
fetch-depth: 1
ref: ${{ steps.vizzu_tag.outputs.vizzu_tag }}
path: vizzu-lib
- name: Build documentation
run: |
source .venv/bin/activate
pdm run build-docs
deploy:
if: ${{ ((github.event_name == 'release' && github.event.action == 'published') || github.event_name == 'workflow_dispatch') }}
runs-on: ubuntu-22.04
env:
PUPPETEER_CACHE_DIR: ${{ github.workspace }}/node_modules/.chromium
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Cache venv
uses: actions/cache@v3
with:
path: .venv
key: venv_ubuntu22_${{ hashFiles('pdm.lock') }}
- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules_ubuntu22_${{ hashFiles('package-lock.json') }}
- name: Get workflow ID
id: workflow_id
run: |
workflow_data=$(curl -s -X GET \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.VIZZUHQ_GITHUB_API }}" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows")
workflow_id=$(echo $workflow_data | jq -r '.workflows[] | select(.name == "CI-CD") | .id')
echo "workflow_id=${workflow_id}" >> $GITHUB_OUTPUT
- name: Get run ID
id: run_id
run: |
run_data=$(curl -s -X GET \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.VIZZUHQ_GITHUB_API }}" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows/${{ steps.workflow_id.outputs.workflow_id }}/runs?branch=main")
run_id=$(echo $run_data | jq -r '.workflow_runs[0].id')
echo "run_id=${run_id}" >> $GITHUB_OUTPUT
- name: Cache coverage
uses: actions/cache@v3
with:
path: .coverage/html
key: coverage_${{ steps.run_id.outputs.run_id }}
- name: Deploy package
run: |
source .venv/bin/activate
pdm run deploy
- name: Get vizzu-lib tag
id: vizzu_tag
run: |
source .venv/bin/activate
vizzu_tag=$(./.venv/bin/python ./tools/ci/get_tag.py)
echo "vizzu_tag=${vizzu_tag}" >> $GITHUB_OUTPUT
- name: Checkout vizzu-lib
uses: actions/checkout@v3
with:
repository: vizzuhq/vizzu-lib
fetch-depth: 1
ref: ${{ steps.vizzu_tag.outputs.vizzu_tag }}
path: vizzu-lib
- name: Configure Git
run: |
git config --global user.name "${{ secrets.VIZZUHQ_GITHUB_USER }}"
git config --global user.email "${{ secrets.VIZZUHQ_GITHUB_EMAIL }}"
- name: Deploy documentation
run: |
source .venv/bin/activate
git fetch origin gh-pages || echo "gh-pages does not exist"
pdm run deploy-docs
git push origin gh-pages