-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Institute major, minor, patch releases - no rc yet * Add release candidates * Improve docs, add more automation * Appease the linter * Fix headers
- Loading branch information
Showing
10 changed files
with
276 additions
and
9 deletions.
There are no files selected for viewing
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,31 @@ | ||
--- | ||
name: "Prerelease" | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' | ||
|
||
jobs: | ||
distribute: | ||
name: Distribute | ||
runs-on: Ubuntu-20.04 | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
- name: Setup python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Setup the dependencies | ||
run: | | ||
python -m pip install --upgrade pipenv | ||
pipenv install --dev | ||
- name: Publish the release to GitHub | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
name: ${{ github.ref }} release | ||
draft: false | ||
prerelease: true |
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,31 @@ | ||
--- | ||
name: "Release" | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
distribute: | ||
name: Distribute | ||
runs-on: Ubuntu-20.04 | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
- name: Setup python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Setup the dependencies | ||
run: | | ||
python -m pip install --upgrade pipenv | ||
pipenv install --dev | ||
- name: Publish the release to GitHub | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
name: ${{ github.ref }} release | ||
draft: false | ||
prerelease: false |
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,33 @@ | ||
<!-- | ||
Copyright 2020-2021 Zeek-Kafka | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
# Maintainers Guide | ||
|
||
This guide is intended for maintainers — anybody with commit access to the `zeek-kafka` repository. | ||
|
||
## Releases | ||
|
||
All `zeek-kafka` releases first have a release candidate prior to being promoted to general availability. | ||
|
||
In order to create a release, you must have `pipenv` and `python3` installed, and then run the following commands, where `$TYPE` is one of `major`, `minor`, `patch`, `build`, or `release`. | ||
|
||
```bash | ||
TYPE=major | ||
REMOTE=origin | ||
|
||
git checkout main # Releases should always come from main | ||
pipenv run invoke version $TYPE | ||
git push --atomic $REMOTE $(git branch --show-current) $(git tag --points-at HEAD) | ||
``` | ||
|
||
The previous commands result in a tagged commit containing updated version references in `zkg.meta` and `README.md` (as defined in `setup.cfg`) being pushed to GitHub, at which point GitHub actions performs the remaining release actions based on `.github/workflows/release.yml` and `.github/workflows/prerelease.yml`. |
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,14 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
|
||
[dev-packages] | ||
bumpversion = "*" | ||
gitpython = "*" | ||
invoke = "*" | ||
|
||
[requires] | ||
python_version = "3.9" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[bumpversion] | ||
current_version = 0.4.0 | ||
commit_message = "Automatically generated release {new_version}" | ||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))? | ||
serialize = | ||
{major}.{minor}.{patch}-{release}{build} | ||
{major}.{minor}.{patch} | ||
commit = True | ||
tag = True | ||
push = True | ||
|
||
[bumpversion:part:release] | ||
optional_value = ga | ||
first_value = rc | ||
values = | ||
rc | ||
ga | ||
|
||
[bumpversion:part:build] | ||
first_value = 1 | ||
|
||
[bumpversion:file:README.md] | ||
|
||
[bumpversion:file:zkg.meta] |
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,62 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Task execution tool & library | ||
""" | ||
|
||
# | ||
# Copyright 2020-2021 Zeek-Kafka | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import re | ||
import sys | ||
from logging import basicConfig, getLogger | ||
from pathlib import Path | ||
|
||
import json | ||
import git | ||
from bumpversion.cli import main as bumpversion | ||
from invoke import task | ||
|
||
LOG_FORMAT = json.dumps( | ||
{ | ||
"timestamp": "%(asctime)s", | ||
"namespace": "%(name)s", | ||
"loglevel": "%(levelname)s", | ||
"message": "%(message)s", | ||
} | ||
) | ||
|
||
basicConfig(level="INFO", format=LOG_FORMAT) | ||
LOG = getLogger("zeek-kafka.invoke") | ||
|
||
CWD = Path(".").absolute() | ||
try: | ||
REPO = git.Repo(CWD) | ||
except git.InvalidGitRepositoryError: | ||
REPO = None | ||
|
||
|
||
@task | ||
def version(_c, version_type): | ||
"""Make a new release of zeek-kafka""" | ||
if REPO.head.is_detached: | ||
LOG.error("In detached HEAD state, refusing to release") | ||
sys.exit(1) | ||
|
||
if version_type not in ["major", "minor", "patch", "build", "release"]: | ||
LOG.error("Please provide a release type of major, minor, patch, build, or release") | ||
sys.exit(1) | ||
|
||
bumpversion([version_type]) |
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