Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions .github/workflows/publish.yml

This file was deleted.

21 changes: 14 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Release (tag from __version__)
name: Release (build + publish + tag)

on:
workflow_dispatch:

permissions:
contents: write # needed to push the tag
contents: write # push tag
id-token: write # OIDC for PyPI trusted publishing

jobs:
tag:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -23,7 +24,7 @@ jobs:
run: |
V=$(python -c "import re,pathlib; print(re.search(r'__version__\s*=\s*\"([^\"]+)\"', pathlib.Path('src/canopy/__init__.py').read_text()).group(1))")
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "Will release v$V"
echo "Releasing v$V"

- name: Refuse if tag already exists
run: |
Expand All @@ -32,12 +33,18 @@ jobs:
exit 1
fi

- name: Configure git identity
- name: Build sdist + wheel
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
python -m pip install --upgrade pip build twine
python -m build
python -m twine check dist/*

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Tag and push
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "v${{ steps.ver.outputs.version }}"
git push origin "v${{ steps.ver.outputs.version }}"
Loading