-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): automate releases with github actions
- Loading branch information
Showing
6 changed files
with
68 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
prerelease: | ||
type: boolean | ||
description: Prerelease | ||
|
||
concurrency: | ||
group: release | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
|
||
if: github.event.ref == 'refs/heads/main' | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.venv | ||
key: poetry-${{ hashFiles('poetry.lock') }} | ||
restore-keys: | | ||
poetry- | ||
- name: Install dependencies | ||
run: | | ||
pip install -U poetry | ||
poetry config virtualenvs.in-project true | ||
poetry install | ||
- name: Run semantic release | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
poetry run semantic-release publish -v DEBUG ${{ github.event.inputs.prerelease == 'true' && '--prerelease' || '' }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
REPOSITORY_USERNAME: __token__ | ||
REPOSITORY_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<!--next-version-placeholder--> | ||
|
||
# v7.15.1 (15 March 2022) | ||
|
||
### Fix | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,10 @@ | ||
# Maintainer's Handbook | ||
|
||
## Release Management | ||
## Make a new release | ||
|
||
The release procedure was recently changed from automatic to manual, due to too | ||
many problems with it. | ||
We're using `python-semantic-release` to generate a changelog, update the | ||
version and publish it to Github and PyPi. | ||
|
||
Here is a rough outline / checklist for the release (explained further below): | ||
|
||
1. Checkout `main` branch, ensure you have all tags | ||
2. Prepare changelog | ||
3. Figure out the next version | ||
4. Update code (CHANGELOG, version info) | ||
5. Pull Request with the version bump. | ||
6. Create tag on the merge commit | ||
7. Upload / edit change log | ||
8. If new deprecations have been introduced, make sure they are listed in the | ||
`Deprecations` issue, and ensure the deprecations are explicitly mentioned in the release notes as well. | ||
|
||
Here's how this works in detail: | ||
|
||
### Get release information | ||
|
||
The `semantic-release` tool can help you with the first few tasks of the above | ||
checklist: | ||
|
||
```bash | ||
# Ensure you're on the current main and have all release tags | ||
git checkout main | ||
git pull origin --tags | ||
|
||
# Prepare changelog | ||
semantic-release changelog --noop --unreleased -D version_source=tag | ||
|
||
# Figure out the next version | ||
semantic-release version --noop -D version_source=tag | ||
``` | ||
|
||
You should verify that the version proposed by `semantic-release` is actually | ||
correct. At the time of writing (2020-01-22), it didn't detect some "BREAKING | ||
CHANGES" labels, for example. Adjust the version to what you think is correct. | ||
|
||
### Update version, changelog in source | ||
|
||
The version is also put in code. Update the file | ||
`caluma/caluma_metadata.py`. | ||
|
||
Put the changelog on top of the `CHANGELOG.md` file along with the proposed date | ||
of release. If needed, amend it with some informative text about the release | ||
|
||
### Create a Pull request for the proposed version bump | ||
|
||
Put the changelog in the commit message or in the PR discussion somewhere, so | ||
it won't be forgotten once the release actually happens. | ||
|
||
Note: If other PRs are merged after you create the version bump PR, you may need | ||
to revisit the changelog, and potentially even the version number to be created. | ||
It is thus important to create and merge the version bump in a timely, | ||
coordinated manner. | ||
|
||
### Create Release | ||
|
||
Once the version bump PR has been merged, take the corresponding merge commit, | ||
and tag it with the version. Note that the tag needs to be prefixed with `v`, | ||
so for example version 5.0.0 will need a tag named exactly `v5.0.0`. | ||
|
||
You should then edit the release on Github and paste the changelog there as well. | ||
|
||
Docker Hub will automatically trigger a build for the new tag, and publish it. | ||
|
||
The `pypi` github workflow will automatically build a source package and a wheel and | ||
publish them on [PyPI](https://pypi.org/project/caluma/). | ||
To release a new version simply head over to [Github | ||
Actions](https://github.com/projectcaluma/caluma/actions/workflows/release.yml) | ||
and trigger the workflow dispatch event on the branch `main`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,15 @@ omit = [ | |
] | ||
show_missing = true | ||
|
||
[tool.semantic_release] | ||
version_toml = "pyproject.toml:tool.poetry.version" | ||
branch = "main" | ||
upload_to_repository = true | ||
upload_to_release = true | ||
build_command = "poetry build" | ||
commit_subject = "chore(release): v{version}" | ||
commit_author = "github-actions <[email protected]>" | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" |