forked from hyperledger/firefly
-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (55 loc) · 2.05 KB
/
docs.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
name: Docs Site
on:
push:
branches:
- main
pull_request:
release:
types: [released]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Docs Deploy
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Check if this is the latest release
run: |
LATEST_TAG=$(
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases/latest \
| jq -r '.tag_name'
)
IS_LATEST=${{ env.LATEST_TAG == github.event.release.tag_name }}
echo This release is: "${{ github.event.release.tag_name }}"
echo The latest release is: "$LATEST_TAG"
echo "IS_LATEST_RELEASE=$IS_LATEST" >> "$GITHUB_ENV"
- name: Install docs dependencies
working-directory: doc-site
run: pip install -r requirements.txt
- name: Update doc site for release
if: ${{ github.event_name == 'release' && env.IS_LATEST_RELEASE != 'true' }}
working-directory: doc-site
run: mike deploy ${{ github.event.release.tag_name }} --push
- name: Update doc site for latest release
if: ${{ github.event_name == 'release' && env.IS_LATEST_RELEASE == 'true' }}
working-directory: doc-site
run: mike deploy ${{ github.event.release.tag_name }} latest -u --push
- name: Update doc site for `main` branch
if: ${{ github.event_name == 'push' }}
working-directory: doc-site
run: mike deploy head --push
- name: Test building the doc site but do not deploy it
if: ${{ github.event_name == 'pull_request' }}
working-directory: doc-site
run: mkdocs build