Skip to content

Commit

Permalink
ci: Add PyPI release workflow (#57)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
manzt authored Apr 19, 2024
1 parent 8625109 commit f00f972
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 14 deletions.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 [email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 28 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit f00f972

Please sign in to comment.