From f00f972212a10845f61a17dd94c3fda0c34883ce Mon Sep 17 00:00:00 2001 From: Trevor Manz Date: Fri, 19 Apr 2024 15:59:07 -0400 Subject: [PATCH] ci: Add PyPI release workflow (#57) * ci: Add PyPI release workflow * chore: Add release notes to README.md * chore: Clarifying changelog * chore: Remove confusing ipyniivue-experimental changelog entries * ci: Add dependabot stuff --- .github/dependabot.yml | 19 ++++++++++++++++ .github/workflows/release.yml | 43 +++++++++++++++++++++++++++++++++++ README.md | 42 ++++++++++++++++++++++------------ 3 files changed, 90 insertions(+), 14 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..7435d9d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + + # Maintain dependencies for npm + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "monthly" + + # Maintain dependencies for Composer + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8f38376 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Release + +on: + push: + tags: + - "v*" + +jobs: + + Release: + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/ipyniivue + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + # For generating GitHub Releases + Release notes + # ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - run: | + pip install uv + uv pip install --system build + python -m build + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + - uses: actions/setup-node@v4 + with: + node-version: 18.x + - run: npx changelogithub@0.12 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 7db0bac..d462fef 100644 --- a/README.md +++ b/README.md @@ -80,17 +80,31 @@ server with `Ctrl+C`. > make sure to `export ANYWIDGET_HMR=1` environment variable. This can be set > directly in a notebook with `%env ANYWIDGET_HMR=1` in a cell. -# Changelog: - -## v0.0.7 - -Change to traitlet approach - -## v0.0.5 - -Adding functions -load_volumes, load_meshes, set_opacity, set_crosshair_width and set_crosshair_color. - -## v0.0.4 - -Setting up the project +## Release Process + +1. Releases are automated using GitHub Actions and the + [`release.yml`](.github/workflows/release.yml) workflow. +2. The workflow is triggered when a new tag matching the pattern `v*` is pushed + to the repository. +3. To create a new release, create a tag from the command line: + ```sh + git tag -a vX.X.X -m "vX.X.X" + git push --follow-tags + ``` +4. When triggered, the workflow will: + - Publish the package to PyPI with the tag version. + - Generate a changelog based on conventional commits and create a GitHub + Release with the changelog. + +### Changelog Generation + +- We generate a changelog for GitHub releases with + [`antfu/changelogithub`](https://github.com/antfu/changelogithub) +- Each changelog entry is grouped and rendered based on conventional commits, + and it is recommended to follow the [Conventional + Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary). +- The tool generates the changelog based on the commits between the latest + release tag and the previous release tag. + +By following this release process and utilizing conventional commits, you can +ensure consistent and informative releases for your project.