Skip to content

v0.23.6

v0.23.6 #2

Workflow file for this run

name: Version Release
on:
push:
tags:
- '\d+\.\d+\.\d+' # Push events to matching d.d.d, i.e. 1.0.0, 15.26.35
jobs:
build:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.5.2
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
pypi-release:
name: Publish on PyPi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.2
- uses: actions/setup-python@v2
with:
python-version: 3.8
# Make sure the version of setup is the same as the version in tag
- name: Get version from pyproject.toml
id: get_version
run: |
pyproject_version=$(python -c "import re; version = re.search(r'version = \"(.+?)\"', open('pyproject.toml').read()).group(1); print(version)")
echo "pyproject_version=$pyproject_version" >> $GITHUB_ENV
init_git_version=$(python -c "import re; version = re.search(r'__version__ = \"(.+?)\"', open('hezar/__init__.py').read()).group(1); print(version)")
echo "init_git_version=$init_git_version" >> $GITHUB_ENV
- name: Extract Git tag
run: |
GIT_TAG=${GITHUB_REF##*/}
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
- name: Check if versions match
run: |
if [[ ${{ env.pyproject_version }} != "${{ env.GIT_TAG }}" ]]; then
echo "[Error]: Version Missmatch!"
exit 1
fi
if [[ ${{ env.GIT_TAG }} != "${{ env.init_git_version }}" ]]; then
echo "[Error]: Version Missmatch!"
exit 1
fi
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine poetry
- name: Publish package to PYPI
run: |
poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}"
poetry publish --build
needs:
- build
docs:
name: Generate source docs and deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Install dependencies
run: |
pip install sphinx myst-parser furo sphinx-copybutton hezar
- name: Sphinx build
run: |
sphinx-apidoc -e -o docs/source hezar/
sphinx-build docs _build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
needs:
- pypi-release