Merge pull request #4 from planetf1/initial #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
workflow_dispatch: | |
push: | |
# Publish `main` as latest | |
branches: | |
- main | |
# Publish `v1.2.3` tags as releases | |
tags: | |
- v* | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # fetch all commits/branches | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- uses: actions/cache@v4 | |
with: | |
key: ${{ github.ref }} | |
path: .cache | |
- name: Install Python dependencies | |
run: pip install -r ./requirements.txt | |
- name: Configure git user | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: Deploy docs | |
run: | | |
# Strip git ref prefix from version | |
echo "${{ github.ref }}" | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && ALIAS=$(echo $VERSION | sed -e 's/^v//') | |
# If building from main, use latest as ALIAS | |
[ "$VERSION" == "main" ] && ALIAS=latest | |
echo $VERSION $ALIAS | |
mike deploy --push --update-aliases $VERSION $ALIAS | |
mike set-default latest |