Skip to content

Commit 80f9f93

Browse files
DanielePalaiaDanielePalaia
andauthored
adding an action to publish on pypi on a new release (#19)
* adding an action to publish on pypi on a new release * running test action on main --------- Co-authored-by: DanielePalaia <daniele985@@gmail.com>
1 parent 683a29f commit 80f9f93

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.github/workflows/build-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Test against a RabbitMQ broker
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
88
types:
99
- opened

.github/workflows/publish-pypi.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: publish-pypi
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
pypi_repository_url:
7+
required: true
8+
type: string
9+
secrets:
10+
pypi_api_login:
11+
required: true
12+
pypi_api_password:
13+
required: true
14+
15+
jobs:
16+
pypi-publish:
17+
name: upload release to PyPI
18+
runs-on: ubuntu-latest
19+
# Specifying a GitHub environment is optional, but strongly encouraged
20+
environment:
21+
name: pypi
22+
url: https://pypi.org/p/rabbitmq-amqp-python-client
23+
permissions:
24+
# IMPORTANT: this permission is mandatory for trusted publishing
25+
id-token: write
26+
steps:
27+
- uses: actions/checkout@v3
28+
- name: build with poetry
29+
env:
30+
REPO: ${{ inputs.pypi_repository_url }}
31+
run: |
32+
curl -sSL https://install.python-poetry.org | python3 -
33+
export PATH="/home/runner/.local/bin:$PATH"
34+
poetry config repositories.test-pypi $REPO
35+
poetry build
36+
# retrieve your distributions here
37+
- name: Publish package distributions to PyPI
38+
uses: pypa/gh-action-pypi-publish@release/v1
39+
with:
40+
verbose: true
41+
attestations: false
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: publish-release
2+
3+
on:
4+
release:
5+
types:
6+
- released
7+
8+
jobs:
9+
call-publish-pypi:
10+
permissions:
11+
id-token: write
12+
uses: ./.github/workflows/publish-pypi.yaml
13+
with:
14+
pypi_repository_url: https://upload.pypi.org/legacy/
15+
secrets:
16+
pypi_api_login: __token__
17+
pypi_api_password: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)