-
-
Notifications
You must be signed in to change notification settings - Fork 17
99 lines (83 loc) · 3.14 KB
/
deploy-documents.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
# Workflow inspiration and adaptation came from Andruino-Cli
# https://github.com/arduino/arduino-cli/blob/master/.github/workflows/deploy-cobra-mkdocs-versioned-poetry.yml
name: Deploy Documents 5.7
env:
PYTHON_VERSION: "3.9"
on:
push:
branches:
# Branch to base "dev" website on. Set in siteversion.py also.
- master
# Release branches have names like 0.8.x, 0.9.x, ...
- "[0-9]+.[0-9]+.x"
create:
jobs:
pre-publish:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
- name: Determine if documentation should be published on this workflow run
id: determination
run: |
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
if [[ "${{ github.event_name }}" == "push" || ( "${{ github.event_name }}" == "create" && "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX ) ]]; then
RESULT="true"
else
RESULT="false"
fi
echo "result=$RESULT" >> $GITHUB_OUTPUT
echo "Deploy documents: $RESULT"
publish:
runs-on: ubuntu-latest
needs: pre-publish
if: needs.pre-publish.outputs.result == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Requirements
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Get sponsors and fanart
run: |
wget -O docs/assets/sponsors.md \
https://raw.githubusercontent.com/phalcon/assets/master/phalcon/sponsors-fragment.html
wget -O overrides/fanart.md \
https://raw.githubusercontent.com/phalcon/assets/master/phalcon/fanart-fragment.html
- name: Update NFR list
run: |
python ./update-nfr.py
- name: Determine versioning parameters
id: determine-versioning
run: |
# Read the first line from the VERSION file
LINE=$(head -n 1 ./VERSION)
# Extract version and alias using parameter expansion
VERSION="${LINE%%|*}"
ALIAS="${LINE#*|}"
# Print the extracted values for verification
echo "Version: $VERSION"
echo "Alias: $ALIAS"
echo "PH_DOCS_VERSION=$VERSION" >> $GITHUB_ENV
echo "PH_DOCS_ALIAS=$ALIAS" >> $GITHUB_ENV
- name: Deploy
if: ${{ env.PH_DOCS_VERSION }} != null
run: |
# Publishing implies creating a git commit on the production branch,
# We will need to create a user for this at some point
echo "Deploying with Mike"
git config user.name niden
git config user.email nikos@niden.net
git fetch --no-tags --prune --depth=1 origin +refs/heads/production:refs/remotes/origin/production
mike deploy \
--update-aliases \
--branch production \
--push \
${{ env.PH_DOCS_VERSION }} \
${{ env.PH_DOCS_ALIAS }}
echo "Deployed"