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

Create the automated release process using googleapis/release-please #262

Open
wants to merge 3 commits into
base: planning-1.0-release
Choose a base branch
from
Open
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
57 changes: 57 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
on:
push:
SemyonSinchenko marked this conversation as resolved.
Show resolved Hide resolved
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

# Following GH step is created based on the following article and the credits to the same
# https://johnfraney.ca/blog/how-to-publish-a-python-package-with-poetry-and-github-actions/
publish-to-pypi:
needs: release-please
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/quinn/
permissions:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ">=3.9,<4.0"

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y

- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Update Poetry configuration
run: poetry config virtualenvs.create false

- name: Install dependencies
run: poetry install --sync --no-interaction

- name: Package project
run: poetry build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.10.3"
}
58 changes: 58 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,61 @@ When you're finished with the changes, create a pull request, also known as a PR
- Don't forget to link PR to the issue if you are solving one.
- As you update your PR and apply changes, mark each conversation as resolved.
- If you run into any merge issues, checkout this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues.

### Release Process

#### How to Create a Release

- **Update `release-please-config.json`:**
- Remove `"versioning": "prerelease"`.
- Set `"prerelease": false`.

- **Ensure correct version bump:**
- If the latest release is `1.0.0` and the latest pre-release is `1.1.0-rc`, and you want to create a release with the version `1.1.0`:
- Set `"bump-minor-pre-major": true` in `release-please-config.json`.
- Change the version in `.release-please-manifest.json` from `1.1.0-rc` to `1.0.0`.

- **Avoid configurations that cause version/release gaps:**
- If `"bump-minor-pre-major": false` and `.release-please-manifest.json` is `1.1.0-rc`, it will create a major release `2.0.0`.
- If `"bump-minor-pre-major": true` and `.release-please-manifest.json` is `1.1.0-rc`, it will create a minor release `1.2.0`.

- **Key points:**
- Downgrade the version in the version file for minor releases.
- Use `"bump-minor-pre-major": true` for minor releases.
- Use `"bump-minor-pre-major": false` for major releases and set the version to the latest release version.

#### How to Create a Pre-Release

- Update the `release-please-config.json` in the root.
- Set `"prerelease"` to `true`.
- Add the line `"versioning": "prerelease"`.
- Ensure the pre-release type is set to `rc`.
- For example, if the current version is `1.0.0` and the following configs are set:
- `"bump-minor-pre-major": true`
- `"bump-patch-for-minor-pre-major": false`
- The pre-release version will be bumped to `1.1.0-rc`.
- If the configs are set as:
- `"bump-minor-pre-major": false`
- `"bump-patch-for-minor-pre-major": false`
- The pre-release version will be `2.0.0-rc`, i.e., the major version will be bumped.


### Conventional Commit Messages

- **Format**: `<type>[optional scope]: <description>`
- **Type**: Specifies the nature of the change (e.g., `feat`, `fix`, `docs`).
- **Scope**: Optional part that specifies the section of the codebase affected.
- **Description**: A brief summary of the change.
- **Body**: Optional detailed explanation of the change.
- **Footer**: Optional additional information, such as breaking changes or issue references.

#### Example

```plaintext
feat(parser): add support for new data format

Added a new parser to handle the VARIANT data format. This change includes updates to the parser module and corresponding tests.

Closes #123
```
For more information on conventional commit messages, check this site: https://www.conventionalcommits.org/en/v1.0.0/
14 changes: 14 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"packages": {
".": {
"changelog-path": "CHANGELOG.md",
"release-type": "python",
"prerelease-type": "rc",
"bump-minor-pre-major": false,
"bump-patch-for-minor-pre-major": false,
"draft": false,
"prerelease": true,
"versioning": "prerelease"
}
}
}
Loading