-
Notifications
You must be signed in to change notification settings - Fork 4
/
action.yml
49 lines (48 loc) · 1.57 KB
/
action.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
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: 'PyPI Release CI'
description: 'Release CI used for PyPI releases'
inputs:
pypi-username:
description: 'The PyPI username for twine'
required: true
pypi-password:
description: 'The PyPI password for twine'
required: true
python-version:
description: 'The version of Python to use in the CI'
required: true
default: '3.11'
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Check For pyproject.toml
id: need-pypi
shell: bash
run: |
echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT
- name: Set up Python
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install dependencies
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
shell: bash
run: |
python -m pip install --upgrade pip
pip install --upgrade build twine
- name: Build and publish
if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml')
env:
TWINE_USERNAME: ${{ inputs.pypi-username }}
TWINE_PASSWORD: ${{ inputs.pypi-password }}
shell: bash
run: |
find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" {} +
python -m build
twine upload dist/*