Skip to content

Commit 53a0c25

Browse files
committed
publish docs
1 parent 8a83770 commit 53a0c25

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish docs
2+
3+
on:
4+
push:
5+
branches:
6+
- "[0-9]+.[0-9]+.x"
7+
8+
jobs:
9+
build:
10+
name: Deploy docs
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.x"
21+
22+
- name: Install dependencies
23+
run: pip install -r docs/requirements.txt
24+
25+
- name: Set up git author
26+
uses: oleksiyrudenko/gha-git-credentials@v2
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Setup deploy key
31+
env:
32+
DEPLOY_DOCS_KEY: ${{ secrets.DEPLOY_DOCS_KEY }}
33+
run: |
34+
# Setup SSH deploy key
35+
mkdir -p ~/.ssh
36+
echo "${DEPLOY_DOCS_KEY}" > ~/.ssh/id_rsa
37+
chmod 600 ~/.ssh/id_rsa
38+
ssh-keyscan -H github.com > ~/.ssh/known_hosts
39+
40+
- run: git remote add doc git@github.com:patchlevel/laravel-event-sourcing-docs.git
41+
- run: git fetch doc gh-pages --verbose
42+
43+
- run: |
44+
mike deploy latest --config-file docs/mkdocs.yml --title="1.0 (latest)" --push --remote doc
45+
- run: |
46+
# Check if the "latest" alias exists
47+
HAS_LATEST=$(mike list --config-file docs/mkdocs.yml --rebase --remote doc | grep latest) || true
48+
49+
# If so then it is set as the default version (to enable the index redirect)
50+
if [ "${HAS_LATEST}" != "" ]
51+
then
52+
echo "Set latest as default"
53+
mike set-default latest --config-file docs/mkdocs.yml --remote doc
54+
fi

0 commit comments

Comments
 (0)