Skip to content

Instructions for GitHub Actions workflow #49

@heitorlessa

Description

@heitorlessa

Hello again :-) I've been trying to use Mike with GH Actions to deploy a develop version upon pushes to the develop branch, and version specific upon a new release (i.e. 1.20.1), however pushing to develop is wiping out existing versions file assets.

The version file looks correct but every time develop branch is updated it wipes all sub-directories for other versions.

Am I missing a special parameter, sequence, or perhaps in this case I should always have an alias tied to a version like mike deploy --push develop unreleased?

Appreciate the help!


Here's a screenshot of the file structure before and after, and the GitHub action workflow:

New release works as expected

image

New develop release wipes out the previous version

image

Develop version workflow

Always builds the latest doc when pushing to develop branch

name: Docs

on:
  push:
    branches:
      - develop

jobs:
  api-docs:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Set up Python
        uses: actions/setup-python@v1
        with:
          python-version: "3.8"
      - name: Install dependencies
        run: make dev
      - name: Setup doc deploy
        run: |
          git config --global user.name Docs deploy
          git config --global user.email [email protected]
      - name: Build docs website and API reference
        run: poetry run mike deploy --push develop

New release version workflow

Creates a new version and update aliases

name: Docs new version release

on:
  release:
    types: [published]

jobs:
  upload:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - name: Set up Python
      uses: actions/setup-python@v1
      with:
        python-version: "3.8"
    - name: Set release notes tag
      run: |
        export RELEASE_TAG_VERSION=${{ github.event.release.tag_name }}
        echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
    - name: Install dependencies
      run: make dev
    - name: Setup doc deploy
      run: |
        git config --global user.name Docs deploy
        git config --global user.email [email protected]
    - name: Release docs website and API reference
      run: |
        poetry run mike deploy --push --update-aliases ${RELEASE_TAG_VERSION} latest
        poetry run mike set-default --push latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions