feat: bump version #75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tag & Release Package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.x' | |
cache: poetry | |
- name: Setup Environment | |
run: | | |
make setup | |
env: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Detect version upgrade | |
id: versioning | |
run: | | |
package_version=$(echo $(poetry version -v) | sed "s/drf-kit //") | |
echo "::set-output name=package_version::"$package_version | |
upgraded=$(git tag --list | grep -q "${package_version}$" && echo "false" || echo "true") | |
echo "::set-output name=upgraded::"$upgraded | |
pre_release=$([[ $package_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "false" || echo "true") | |
echo "::set-output name=pre_release::"$pre_release | |
- name: Create Release | |
if: ${{ steps.versioning.outputs.upgraded == 'true' }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.versioning.outputs.package_version }} | |
release_name: Release ${{ steps.versioning.outputs.package_version }} | |
body: | | |
Auto-released by bot. | |
See commit changes. | |
draft: false | |
prerelease: ${{ steps.versioning.outputs.pre_release }} | |
- name: Build & Release package | |
if: ${{ steps.versioning.outputs.upgraded == 'true' }} | |
run: | | |
make publish | |
env: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |