Skip to content

Commit d8f208c

Browse files
committed
ci(github-actions): replace publish-pypi workflow with PYPA version
1 parent 5f2e92c commit d8f208c

File tree

2 files changed

+57
-41
lines changed

2 files changed

+57
-41
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
# This workflow will upload a Python Package using PYPA GiHub Action.
3+
# For more information see: https://github.com/pypa/gh-action-pypi-publish
4+
name: PyPI release
5+
6+
on:
7+
release:
8+
types: [created]
9+
workflow_dispatch:
10+
inputs:
11+
tag_name:
12+
description: 'Tag name to release'
13+
required: false
14+
15+
jobs:
16+
pypi-build-publish:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
python-version: ['3.9', '3.10', '3.11', '3.12']
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Get tag name from input or Git
32+
id: get_tag
33+
run: |
34+
if [ "${{ github.event.inputs.tag_name }}" ]; then
35+
echo "TAG=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
36+
else
37+
echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
38+
fi
39+
40+
- name: Display tag
41+
run: echo "Releasing version $TAG"
42+
43+
- name: Install dependencies
44+
run: |-
45+
python -m pip install --upgrade pip
46+
pip install build
47+
48+
- name: Build package
49+
run: |-
50+
python -m build
51+
52+
- name: Publish package distributions to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
with:
55+
password: ${{ secrets.PYPI_PROJECT_TOKEN }}
56+
skip-existing: true
57+
verify-metadata: true

0 commit comments

Comments
 (0)