-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ca4817
commit 57c5a3f
Showing
8 changed files
with
187 additions
and
4 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,12 @@ | ||
[bumpversion] | ||
current_version = 0.13.0 | ||
commit = True | ||
tag = False | ||
|
||
[bumpversion:file:docs/index.md] | ||
search = pygitops - {current_version} | ||
replace = pygitops - {new_version} | ||
|
||
[bumpversion:file:setup.cfg] | ||
search = version = {current_version} | ||
replace = version = {new_version} |
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,36 @@ | ||
name: Version Bump merged | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- "closed" | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
trigger-release: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged && | ||
startsWith(github.head_ref, 'bump_version_to_') && | ||
startsWith(github.event.pull_request.title, 'Bump version') && | ||
contains(github.event.pull_request.title, ' → ') | ||
environment: Create Release | ||
steps: | ||
- name: Get new version | ||
id: get-new-version | ||
run: | | ||
NEW_VERSION=$(echo ${{ github.head_ref }} | cut -d _ -f4 ) | ||
echo "::set-output name=version::$NEW_VERSION" | ||
- name: Is prerelease? | ||
id: is-prerelease | ||
run: | | ||
IS_PRERELEASE=$([[ "${{ steps.get-new-version.outputs.version }}" == *-[a-z]* ]] && echo true || echo false) | ||
echo "::set-output name=result::$IS_PRERELEASE" | ||
- name: Create Release | ||
# use hash for security since this has access to the access token | ||
uses: ncipollo/release-action@880be3d0a71bc0fa98db60201d2cbdc27324f547 # v1.8.6 | ||
with: | ||
token: ${{ secrets.ACCESS_TOKEN }} | ||
tag: v${{ steps.get-new-version.outputs.version }} | ||
name: v${{ steps.get-new-version.outputs.version }} Release | ||
commit: 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
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,57 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Referenced From: https://github.com/wayfair-incubator/columbo/blob/main/docker/bump_version.sh | ||
|
||
set -eo pipefail | ||
|
||
DEFAULT_BRANCH="main" | ||
|
||
function usage() { | ||
echo "usage: bump_version.sh major|minor|patch" | ||
echo "" | ||
echo " major|minor|patch : Part of version string to updated." | ||
exit 1 | ||
} | ||
|
||
if [[ $# != 1 || ! "${1}" =~ major|minor|patch ]]; then | ||
usage | ||
else | ||
PART="${1}" | ||
fi | ||
|
||
CURRENT_BRANCH=$(git branch --show-current) | ||
CURRENT_STATUS=$(git status --short --untracked-files=no) | ||
|
||
if [[ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]]; then | ||
echo "A version bump must be run from the default branch." | ||
echo "Run 'git switch ${DEFAULT_BRANCH}'" | ||
exit 2 | ||
elif [[ "$CURRENT_STATUS" != "" ]]; then | ||
echo "The working tree has uncommitted changes." | ||
echo "Commit or stash the changes before running a version bump." | ||
exit 3 | ||
fi | ||
# Ensure on default branch | ||
git switch --no-guess main | ||
# Capture value of new version | ||
NEW_VERSION=$(bump2version --dry-run --list "${PART}" | grep new_version | sed -r s,"^.*=",,) | ||
# Create bump branch | ||
BUMP_BRANCH_NAME="bump_version_to_${NEW_VERSION}" | ||
git switch -c "${BUMP_BRANCH_NAME}" | ||
# Update files | ||
bump2version "${PART}" | ||
|
||
# Updating the changelog has to be done manually | ||
# - bump2version doesn't support inserting dates https://github.com/c4urself/bump2version/issues/133 | ||
# - It is not possible to have a multiline string in an INI file where a line after the first line starts with '#'. | ||
# The config parser reads it as a comment line. | ||
TODAY=$(date +%Y-%m-%d) | ||
sed -i "s/## \[Unreleased\]/## \[Unreleased\]\n\n## \[${NEW_VERSION}\] - ${TODAY}/g" CHANGELOG.md | ||
|
||
# Add changelog to bump commit | ||
git add CHANGELOG.md | ||
git commit --amend --no-edit | ||
# Show effected files | ||
git show --pretty="" --name-only | ||
|
||
echo "Run 'git push --set-upstream origin ${BUMP_BRANCH_NAME}' to " |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
bandit==1.7.0 | ||
black==21.9b0 | ||
bump2version==1.0.1 | ||
flake8==3.9.2 | ||
isort==5.9.3 | ||
mypy==0.910 | ||
|