-
Notifications
You must be signed in to change notification settings - Fork 81
47 lines (44 loc) · 1.5 KB
/
python-publish.yml
File metadata and controls
47 lines (44 loc) · 1.5 KB
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: Upload Python Package to PYPI
on:
pull_request:
branches: main
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install poetry
run: python -m pip install poetry
- name: Update patch version of package
id: versionUpdate
run: |
poetry version patch
echo "::set-output version=$(poetry version -s)"
- name: Commit and push changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions@users.noreply.github.com"
git checkout -b release-${{ steps.versionUpdate.outputs.version }}
git add .
git commit -m "${{ steps.versionUpdate.outputs.version }} release"
git push origin release-${{ steps.versionUpdate.outputs.version }}
- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
title: Release ${{ steps.versionUpdate.outputs.version }}
branch: release-${{ steps.versionUpdate.outputs.version }}
base: main
- name: Build and upload python package
env:
username: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry publish --build -u ${username} -p ${password}}