Skip to content

Commit 327c16e

Browse files
authored
Merge pull request #389 from Metaswitch/md/trustedpublisher
Fix PyPI publishing and retag
2 parents e6bad36 + 417f0f5 commit 327c16e

File tree

6 files changed

+19
-10
lines changed

6 files changed

+19
-10
lines changed

.github/workflows/deploy.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,25 @@ on:
66
jobs:
77
Deploy:
88
runs-on: ubuntu-latest
9+
permissions:
10+
# IMPORTANT: this permission is mandatory for Trusted Publishing
11+
id-token: write
912
steps:
1013
- name: 'Set up Python'
1114
uses: actions/setup-python@v5
1215
with:
1316
python-version: 3.9
1417
- uses: actions/checkout@v4
1518
- run: bash install.sh
19+
# Build the package and publish it.
20+
- run: poetry build
21+
- name: Publish package distributions to PyPI
22+
uses: pypa/gh-action-pypi-publish@release/v1
23+
# Build the docker image and publish it
1624
- run: bash deploy.sh
1725
env:
1826
DOCKER_USER: ${{ secrets.DOCKER_USER }}
1927
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
20-
PYPI_USER: ${{ secrets.PYPI_USER }}
21-
PYPI_PASS: ${{ secrets.PYPI_PASS }}
2228
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2329
- run: bash after_deploy.sh
2430
env:

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ version number is tracked in the file `pyproject.toml`.
1414

1515
### Fixed
1616

17+
## [6.0.1] - 2025-03-11
18+
19+
### Fixed
20+
- Fix PyPI publishing
21+
1722
## [6.0.0] - 2025-03-11
1823

1924
### Breaking Changes
@@ -109,7 +114,8 @@ version number is tracked in the file `pyproject.toml`.
109114

110115
### Added
111116

112-
[unreleased]: https://github.com/Metaswitch/announcer/compare/6.0.0...HEAD
117+
[unreleased]: https://github.com/Metaswitch/announcer/compare/6.0.1...HEAD
118+
[6.0.1]: https://github.com/Metaswitch/announcer/compare/6.0.0...6.0.1
113119
[6.0.0]: https://github.com/Metaswitch/announcer/compare/5.0.0...6.0.0
114120
[5.0.0]: https://github.com/Metaswitch/announcer/compare/4.0.1...5.0.0
115121
[4.0.1]: https://github.com/Metaswitch/announcer/compare/4.0.0...4.0.1

after_deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
echo "Announce changes to the world!"
44

5-
VERSION=$(tomlq -r '.tool.poetry.version' pyproject.toml)
5+
VERSION=$(tomlq -r '.project.version' pyproject.toml)
66
echo "Version: $VERSION"
77

88
# Send announcement to a standalone test webhook.

deploy.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#!/usr/bin/env bash
22

3-
VERSION=$(tomlq -r '.tool.poetry.version' pyproject.toml)
3+
VERSION=$(tomlq -r '.project.version' pyproject.toml)
44
echo "Version: $VERSION"
55

66
# Log into docker
77
docker login -u $DOCKER_USER -p $DOCKER_PASS
88

9-
echo "Deploying to pypi"
10-
poetry publish --username $PYPI_USER --password $PYPI_PASS --build
11-
129
# Try and compile the Docker image - this will fail while the package isn't yet released.
1310
while ! docker build --build-arg VERSION=$VERSION -t metaswitch/announcer:$VERSION .
1411
do

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ set -ex
55
# Because poetry doesn't support dev-dependency extras, we need to install these
66
# tools outside of the tox poetry environment (because they're not required inside).
77
#
8-
pip install -U poetry tox-gh-actions tomlq
8+
pip install -U poetry tox-gh-actions yq

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "announcer"
33
description = "Announce changes in keepachangelog-style CHANGELOG.md files to Slack and Microsoft Teams"
44
license = "MIT"
55
keywords = ['slack', 'teams']
6-
version = "6.0.0"
6+
version = "6.0.1"
77
readme = "README.md"
88
authors = [{name = "Max Dymond", email = "max.dymond@metaswitch.com"}]
99
requires-python = '>=3.9,<4.0.0'

0 commit comments

Comments
 (0)