Skip to content

Commit

Permalink
Merge pull request #61 from uktrade/ci/workflow-to-deploy-to-pypi
Browse files Browse the repository at this point in the history
ci: workflow to deploy to PyPI
  • Loading branch information
michalc authored Mar 13, 2024
2 parents 8ad8132 + 9b6ddf9 commit e9daca8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/deploy-package-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy package to PyPI

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v3
with:
python-version: 3.11

- name: Update version in pyproject.toml from current git tag
run: >-
sed -i "s/0\\.0\\.0\\.dev0/${GITHUB_REF/refs\/tags\/v/}/g" pyproject.toml
- run: |
pip install build
python -m build
- uses: actions/upload-artifact@v3
with:
path: ./dist

deploy:
needs: ['build']
environment: 'pypi'

name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v3

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: artifact/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "mobius3"
version = "0.0.41"
version = "0.0.0.dev0"
authors = [
{ name="Department for Business and Trade", email="[email protected]" },
]
Expand Down

0 comments on commit e9daca8

Please sign in to comment.