Skip to content

v0.24.2

v0.24.2 #5

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/[email protected]
- 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/[email protected]
- 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