diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index d4c98e4..af2ab1a 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -3,7 +3,7 @@ name: Test against a RabbitMQ broker on: push: branches: - - master + - main pull_request: types: - opened diff --git a/.github/workflows/publish-pypi.yaml b/.github/workflows/publish-pypi.yaml new file mode 100644 index 0000000..9eeb4cb --- /dev/null +++ b/.github/workflows/publish-pypi.yaml @@ -0,0 +1,41 @@ +name: publish-pypi + +on: + workflow_call: + inputs: + pypi_repository_url: + required: true + type: string + secrets: + pypi_api_login: + required: true + pypi_api_password: + required: true + +jobs: + pypi-publish: + name: upload release to PyPI + runs-on: ubuntu-latest + # Specifying a GitHub environment is optional, but strongly encouraged + environment: + name: pypi + url: https://pypi.org/p/rabbitmq-amqp-python-client + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: + - uses: actions/checkout@v3 + - name: build with poetry + env: + REPO: ${{ inputs.pypi_repository_url }} + run: | + curl -sSL https://install.python-poetry.org | python3 - + export PATH="/home/runner/.local/bin:$PATH" + poetry config repositories.test-pypi $REPO + poetry build + # retrieve your distributions here + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + attestations: false diff --git a/.github/workflows/publish_release.yaml b/.github/workflows/publish_release.yaml new file mode 100644 index 0000000..04c6bc0 --- /dev/null +++ b/.github/workflows/publish_release.yaml @@ -0,0 +1,17 @@ +name: publish-release + +on: + release: + types: + - released + +jobs: + call-publish-pypi: + permissions: + id-token: write + uses: ./.github/workflows/publish-pypi.yaml + with: + pypi_repository_url: https://upload.pypi.org/legacy/ + secrets: + pypi_api_login: __token__ + pypi_api_password: ${{ secrets.PYPI_TOKEN }} \ No newline at end of file