diff --git a/.github/workflows/update-doc.yml b/.github/workflows/update-doc.yml new file mode 100644 index 000000000..a427dfaae --- /dev/null +++ b/.github/workflows/update-doc.yml @@ -0,0 +1,48 @@ +name: update documentation + +on: + push: + branches: + - main + tags: + - v* + +permissions: + contents: write + +jobs: + deplou: + 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: | + cd doc-site + 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: | + cd doc-site + # 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 +