-
Notifications
You must be signed in to change notification settings - Fork 2
60 lines (50 loc) · 1.5 KB
/
deploy.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
name: Deploy MkDocs with Mike
on:
push:
branches:
- prod
- stage
- sandbox
- sandbox-test
pull_request:
branches:
- sandbox-test
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Install Dependencies
run: |
pip install -r requirements.txt
- name: Get Branch Name
id: branch
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "Forcing the version to be sandbox-test for PRs"
echo "branch_name=sandbox-test" >> $GITHUB_ENV
else
echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
fi
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "[email protected]"
- name: Delete Existing Version (If Exists)
run: |
git fetch origin gh-pages
python script.py
mike delete ${{ env.branch_name }} --push || echo "Version does not exist, continuing..."
- name: Deploy Site with Mike
run: |
mike deploy --push --update-aliases ${{ env.branch_name }} latest
- name: Set Default Version (Optional)
run: |
mike set-default --push latest