Skip to content

Commit

Permalink
Add release workflow and automatic versioning (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
kratman authored Oct 28, 2024
1 parent e32e7de commit 5e7a596
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish to PyPI

on:
release:
types: [published]


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Release:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
permissions:
id-token: write

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update version
run: |
export RELEASE_VERSION=$(echo ${{ github.ref_name }} | sed -e 's/v//g')
echo "__version__ = \"$RELEASE_VERSION\"" > ionworksmetrics/version.py
- name: Build wheel
run: |
pip wheel . --no-deps -w deploy
- name: Upload package
uses: actions/upload-artifact@v2
with:
name: wheels
path: deploy/
if-no-files-found: error

- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: deploy/
1 change: 1 addition & 0 deletions ionwizard/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.0.0"
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ ionwizard-container = "ionwizard.container_wizard:run"
include = ["ionwizard"]

[tool.setuptools.dynamic]
version = {attr = "ionwizard.version.__version__"}
readme = {file = ["README.md"], content-type = "text/markdown"}

0 comments on commit 5e7a596

Please sign in to comment.