Skip to content

Commit

Permalink
adding github action
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Dec 17, 2023
1 parent 06f3758 commit 060e98d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 4 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/deploy-documents.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Deploy Documents

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:
publish-determination:
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
publish:
runs-on: ubuntu-latest
needs: publish-determination
if: needs.publish-determination.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: Create all generated documentation content
run: mkdocs build

- name: Determine versioning parameters
id: determine-versioning
run: echo 'data={"version":"5.4.0", alias="latest"}' >> $GITHUB_OUTPUT

- name: Deploy
if: fromJson(steps.determine-versioning.outputs.data).version != null
run: |
# Publishing implies creating a git commit on the gh-pages branch, we let @ArduinoBot own these commits.
git config --global user.email "[email protected]"
git config --global user.name "Phalcon Team Deploy Bot"
git fetch --no-tags --prune --depth=1 origin +refs/heads/production:refs/remotes/origin/production
poetry run mike deploy \
--update-aliases \
--push \
--remote origin \
${{ fromJson(steps.determine-versioning.outputs.data).version }} \
${{ fromJson(steps.determine-versioning.outputs.data).alias }}
4 changes: 0 additions & 4 deletions docs/versions.json

This file was deleted.

0 comments on commit 060e98d

Please sign in to comment.