Skip to content

Commit

Permalink
release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mbway committed Mar 24, 2024
1 parent b6435ba commit 7e24abc
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release

# based on https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

on:
push:
tags: ["v*"]
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build distributions
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Dependencies
run: python -m pip install --upgrade build
- name: Build
run: python3 -m build
- name: Store packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
environment:
name: release
url: https://test.pypi.org/p/mbway-maturin-import-hook
permissions:
id-token: write
if: "startsWith(github.ref, 'refs/tags/')"
needs: [build]
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
10 changes: 10 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,13 @@ of those linters.
The configuration starts with all `ruff` lints enabled with a list of specifically disabled lints.
If you are writing new code that is triggering a lint that you think ought to be disabled, you can suggest this in
a PR, but generally stick to conforming to the suggested linter rules.


## Making a release

1. bump the version number in `pyproject.toml`.
2. update `Changelog.md` to reflect the new changes.
3. check out the commit you want to make a release from
4. run `git tag <version>` e.g. `git tag v0.1.0`
5. run `git push origin <version>` e.g. `git tag v0.1.0`
- this will trigger the 'release' github action which will upload to PyPi
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[project]
name = "maturin-import-hook"
name = "mbway-maturin-import-hook"
description = "import hook to load rust projects built with maturin"
authors = [
{name = "Matthew Broadway", email = "mattdbway@gmail.com"}
]
readme = "README.md"
version = "0.1.0"
version = "0.1.1"
requires-python = ">=3.8"
dependencies = [
"filelock",
Expand Down

0 comments on commit 7e24abc

Please sign in to comment.