-
Notifications
You must be signed in to change notification settings - Fork 9
52 lines (50 loc) · 1.74 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Tag & Release Package
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12.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 }}