forked from soynatan/django-easy-audit
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (66 loc) · 2.37 KB
/
cd.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Publish Python 🐍 package 📦 to PyPI
on:
push:
branches:
- master
workflow_dispatch:
jobs:
get-package-version:
name: Get ${{ github.ref_name }} package version
runs-on: ubuntu-latest
outputs:
package-version: ${{ steps.package-version.outputs.package-version }}
version-compairson: ${{ steps.semver.outputs.comparison-result}}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Get package version
id: package-version
run: echo "package-version=v$(poetry version --short)" >> $GITHUB_OUTPUT
- name: Get release version
id: release-version
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
- name: Analyze semver
id: semver
uses: madhead/semver-utils@latest
with:
lenient: false
version: ${{ steps.package-version.outputs.package-version }}
compare-to: ${{ steps.release-version.outputs.release }}
- name: Check pre-release
if: ${{ steps.semver.outputs.prerelease != '' }}
run: |
echo "Checking if version is a pre-release"
echo "::error::Skipping pre-release version: ${{ steps.package-version.outputs.package-version}}"
exit 1
deploy:
name: Deploy Python 🐍 distributions 📦 to PyPI
needs: [get-package-version]
runs-on: ubuntu-latest
if: ${{ needs.get-package-version.outputs.version-compairson != '=' }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v3
- name: Build and publish to PyPI
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
- name: Create release ${{ needs.get-package-version.outputs.package-version }}
uses: ncipollo/release-action@v1
with:
commit: ${{ github.ref_name }}
tag: ${{ needs.get-package-version.outputs.package-version }}
generateReleaseNotes: true
artifacts: |
dist/*.whl
dist/*.tar.gz