-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (44 loc) · 1.55 KB
/
python-publish.yml
File metadata and controls
54 lines (44 loc) · 1.55 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
48
49
50
51
52
53
54
name: Publish Python Package
on:
release:
types: [published]
permissions:
contents: write
pull-requests: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Bump version
run: |
echo "Bumping version..."
echo "version = \"${{ github.event.release.tag_name }}\"" > src/pydom/version.py
echo "" >> src/pydom/version.py
echo "Version bumped to ${{ github.event.release.tag_name }}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: "Bump version to ${{ github.event.release.tag_name }}"
body: "This PR bumps the version to `${{ github.event.release.tag_name }}` for release."
branch: version-bump-${{ github.event.release.tag_name }}
base: main
commit-message: "Bump version to ${{ github.event.release.tag_name }}"
delete-branch: true
- name: Switch to version bump branch
run: git checkout version-bump-${{ github.event.release.tag_name }}
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}