-
Notifications
You must be signed in to change notification settings - Fork 53
55 lines (47 loc) · 1.74 KB
/
on-merge-master.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
name: Publish docs on GitHub Pages
on:
push:
branches:
- master
jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v3
- name: Get current app version
id: vars
run: |
echo ::set-output name=version::$(grep "__version__ =" Squest/version.py |awk '{printf $3}' | sed -e 's/^"//' -e 's/"$//')
- name: Print app version
run: |
echo ${{ steps.vars.outputs.version }}
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs==1.6.0 mkdocs-material==9.5.22 mike==2.1.1
- name: Get current branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Publish last version
run: |
set -e
if ! git config --get user.name; then
git config --global user.name "${GITHUB_ACTOR}"
fi
if ! git config --get user.email; then
git config --global user.email "${GITHUB_ACTOR}@users.noreply.${GITHUB_DOMAIN:-"github.com"}"
fi
remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git"
git remote rm origin
git remote add origin "${remote_repo}"
git checkout --orphan gh-pages
git pull origin gh-pages
git checkout ${{ steps.extract_branch.outputs.branch }}
mike deploy --push --update-aliases ${{ steps.vars.outputs.version }} latest --alias-type=redirect