-
Notifications
You must be signed in to change notification settings - Fork 3
47 lines (39 loc) · 1.28 KB
/
python-publish.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
name: Publish Python Package
on:
pull_request:
branches:
- master
types:
- closed
permissions:
contents: write
jobs:
deploy:
# Only run if the closed pull request was merged, and didn't contain the `skip-release` tag
if: ${{ (github.event.pull_request.merged == true) && (!contains(github.event.pull_request.labels.*.name, 'skip-release')) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Get package version
run: echo "PACKAGE_VERSION=$(poetry version -s)" >> $GITHUB_ENV
- name: Build and publish to PyPI
run: poetry publish --build -u __token__ -p $PYPI_API_TOKEN
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
- name: Create Tag Release
uses: beyond5959/create-release-github@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.PACKAGE_VERSION }}
release_name: v${{ env.PACKAGE_VERSION }}
draft: false
prerelease: false