generated from athackst/vscode_ros2_workspace
-
Notifications
You must be signed in to change notification settings - Fork 2
124 lines (109 loc) · 4.24 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
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
name: Docs Site
on:
push:
branches:
- main
pull_request:
# default types and closed
types: [opened, synchronize, reopened, closed]
jobs:
# https://github.com/nosborn/github-action-markdown-cli
markdownlint:
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout workspace
uses: actions/checkout@v4
- name: Run linter
uses: nosborn/[email protected]
with:
config_file: .markdownlint.json
files: .
dot: true
# https://github.com/gaurav-nelson/github-action-markdown-link-check
markdown-link-check:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout workspace
uses: actions/checkout@v4
- name: Run linter
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: .markdown-link-check.json
folder-path: .
markdown-link-redirection-check:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Check links to external sites redirect to a new tab
uses: ./.github/actions/docs-lint/
env:
ROOT: './docs/'
# https://squidfunk.github.io/mkdocs-material/publishing-your-site/#with-github-actions
docs-update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# very hacky I know but I can't think of a better way right now
- name: Wait for docs to deploy
if: github.event_name == 'pull_request' && github.event.action == 'closed'
shell: bash
run: sleep 120
- name: Check out code
uses: actions/checkout@v4
with:
# checkout all commits to get accurate page revision times
# for the git-revision-date-localized plugin
# and to fetch the gh-pages branch
fetch-depth: '0'
- name: Start containers
shell: bash
run: docker compose -f .devcontainer/docker-compose.yml -f .devcontainer/docs/docker-compose.docs.yml up -d
- name: Build docs
if: github.event_name == 'push' || github.event.action != 'closed'
shell: bash
run: docker compose -f .devcontainer/docker-compose.yml exec -T docs /bin/sh -c "mkdocs build"
- name: "Delete pr-${{ github.event.number }} version of the Docs"
if: github.event_name == 'pull_request' && github.event.action == 'closed'
shell: bash
run: |
docker compose -f .devcontainer/docker-compose.yml exec -T docs /bin/sh -c "\
git config user.name ci-bot && \
git config user.email [email protected] && \
mike delete --push pr-${{ github.event.number }}"
- name: "Deploy pr-${{ github.event.number }} version of the Docs"
if: github.event_name == 'pull_request' && github.event.action != 'closed'
shell: bash
run: |
docker compose -f .devcontainer/docker-compose.yml exec -T docs /bin/sh -c "\
git config user.name ci-bot && \
git config user.email [email protected] && \
git switch gh-pages && \
git switch - --detach && \
mike deploy pr-${{ github.event.number }} && \
git switch gh-pages && \
git pull --no-rebase && \
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/UBCSailbot/sailbot_workspace.git && \
git push"
- name: Deploy main version of the Docs
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
shell: bash
run: |
docker compose -f .devcontainer/docker-compose.yml exec -T docs /bin/sh -c "\
git config user.name ci-bot && \
git config user.email [email protected] && \
git switch gh-pages && \
git switch - && \
mike deploy --update-aliases main latest && \
git switch gh-pages && \
git pull --no-rebase && \
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/UBCSailbot/sailbot_workspace.git && \
git push"