Skip to content

Workflow file for this run

name: Publish Docs & PyPI Package
on:
release:
types: [ created ]
jobs:
release:
name: Create release artifacts
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all commits/branches so that mike works
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1.3
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: poetry install --no-interaction
- name: Build source and wheel archives
run: |
poetry version $(git describe --tags --abbrev=0)
poetry build
- name: Publish distribution to PyPI
if: github.repository == 'linkml/linkml-model'
uses: pypa/gh-action-pypi-publish@v1.2.2
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Parse version from tag
id: version
uses: release-kit/semver@v2
- name: Configure git user
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Generate markdown docs from schema
run: make gen-doc
- name: Deploy docs
if: github.event.release.prerelease == false
run: |
# generate HTML from markdown and put into MAJOR.MINOR version, update "latest" alias
poetry run mike deploy --update-aliases ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.x latest
# copy the latest linkml_model files up to the root
git checkout --force gh-pages
rm -rf linkml_model
cp -r latest/linkml_model .
git add -A linkml_model
git commit -m "Copy latest linkml_model to root level" || echo "No changes to linkml_model to commit"
# copy over the latest 404.html from the tag
git checkout --force ${{github.event.release.tag_name}} -- 404.html
git commit -m "Add 404.html to root" || echo "No changes to 404.html to commit"
# push changes to gh-page branch
git push origin gh-pages