Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Adding release drafter #719

Merged
merged 10 commits into from
Jul 25, 2024
66 changes: 66 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
exclude-labels:
# When PR will not be classified if it has these labels
- skip changelog
- release
name-template: 'Sparse v$RESOLVED_VERSION'

change-template: '- $TITLE (#$NUMBER)'

autolabeler:
- label: breaking
title:
# Example: feat!: ...
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)(\(.*\))?\!\: /'
- label: build
title:
- '/^(build)/'
- label: internal
title:
- '/^(chore|ci|refactor|test)/'
- label: deprecation
title:
- '/^depr/'
- label: documentation
title:
- '/^(docs|docstring)/'
- label: enhancement
title:
- '/^feat/'
- label: fix
title:
- '/^fix/'
- label: performance
title:
- '/^perf/'
- label: release
title:
- '/^release/'
- label: 'skip changelog'
title:
- '/^\[pre-commit.ci\]/'
categories:
- title: Highlights
labels: highlight
- title: Breaking changes
labels:
- breaking
- breaking python
- title: Deprecations
labels: deprecation
- title: Performance improvements
labels: performance
- title: Enhancements
labels: enhancement
- title: Bug fixes
labels: fix
- title: Documentation
labels: documentation
- title: Build system
labels: build
- title: Other improvements
labels: internal

template: |
## Changes

$CHANGES
40 changes: 40 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize, edited]
# pull_request_target event is required for autolabeler to support PRs from forks
pull_request_target:
types: [opened, reopened, synchronize, edited]

permissions:
contents: read

jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v6
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ after forking and cloning the repository:
pip install -e .[all]
```

## Pull requests

Please adhere to the following guidelines:

1. Start your pull request title with a [conventional commit](https://www.conventionalcommits.org/) tag. This helps us add your contribution to the right section of the changelog. We use "Type" from the [Angular convention](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type).<br>
TLDR:<br>
The PR title should start with any of this abbreviatons: `build`, `chore`, `ci`, `depr`,
`docs`, `feat`, `fix`, `perf`, `refactor`, `release`, `test`. Add a `!`at the end, if it is a breaking change. For example `refactor!`.
2. This text will end up in the changelog.
3. Please follow the instructions in the pull request form and submit.

## Running/Adding Unit Tests

It is best if all new functionality and/or bug fixes have unit tests added
Expand Down
11 changes: 9 additions & 2 deletions release-procedure.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
* Update changelog in docs/changelog.rst and commit.

* Tag commit
```bash
git tag -a x.x.x -m 'Version x.x.x'
Expand All @@ -9,6 +7,7 @@
```bash
git push pydata main --tags
```
When you open the PR on GitHub, make sure the title of the PR starts with "release".

* Upload to PyPI
```bash
Expand All @@ -17,6 +16,14 @@
twine upload dist/* # upload packages
```

* Update the release drafter:
Go to https://github.com/pydata/sparse
Under the “Release" section there are two links: One is the latest release (it has a tag).
The second one is +<number of releases>. Click on the second one so you can see the release drafter.
Edit the draft by clicking the "pencil" figure.
Make sure you have the correct tags. If they are not, you can create one.
If the markdown page looks correct, click on “Publish release”.
<br>
* Enable the newly-pushed tag for documentation: https://readthedocs.org/projects/sparse-nd/versions/
* Wait for conda-forge to realise that the build is too old and make a PR.
* Edit and merge that PR.
Expand Down
Loading