-
Notifications
You must be signed in to change notification settings - Fork 1
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
New Actions And Workflow for bumping version #136
Open
yordanovsstoyan
wants to merge
32
commits into
main
Choose a base branch
from
feat/new-bumpversion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
0375c17
commit-message
yordanovsstoyan a0416c6
commit-message
yordanovsstoyan 82db094
commit-message
yordanovsstoyan 99c4971
commit-message
yordanovsstoyan 78b45d4
reboot
yordanovsstoyan 54c86f7
test
yordanovsstoyan d0d3c60
test
yordanovsstoyan 0b030f3
test
yordanovsstoyan 7a76951
remove-variable
yordanovsstoyan 2c7f4c0
changes
yordanovsstoyan a2a3e0c
fix: remove redundant action
DerTiedemann 5eea497
fix:
DerTiedemann 43f8923
lint: fix actionlint complaints
DerTiedemann fbfe193
fix: add missing inline bash operator
DerTiedemann c12b090
chore: prep new version for release
DerTiedemann eda6cff
Revert "chore: prep new version for release"
DerTiedemann e592eec
fix: make sure there is an empty string for the comparison
DerTiedemann f1bc6f0
fix: remove deprecated flags
DerTiedemann e58ea38
fix: only use bump
DerTiedemann 332f3eb
fix: proper outpuit
DerTiedemann 7df58c7
fix: new chamgelog action
DerTiedemann e170273
fix: use different commit message for second commit
DerTiedemann e091bd6
test
DerTiedemann f1ec7de
fix: try single push
DerTiedemann 9365e3d
fix: add git username + email
DerTiedemann 78af696
fix: try with push
DerTiedemann e70c241
fix: add pull command
DerTiedemann 5926df2
fix: add git config
DerTiedemann cb5bc5b
fix: try to use checkout to pull the latest changes
DerTiedemann 1800eff
fix: try using normal git commits
DerTiedemann c3668a6
fix: persist credentials
DerTiedemann 892c704
fix: make commit message correct
DerTiedemann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -59,13 +59,22 @@ jobs: | |
ref: ${{ github.event.repository.default_branch }} | ||
persist-credentials: false # required for pushing to protected branch later | ||
|
||
- name: Bump version | ||
- name: Remove snapshot suffix | ||
id: bump-version | ||
uses: bakdata/ci-templates/actions/bump-version@v1.21.2 | ||
uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion | ||
with: | ||
release-type: ${{ inputs.release-type }} | ||
release-type: "release" | ||
working-directory: ${{ inputs.working-directory }} | ||
|
||
- name: Commit and push changes including .bumpversion.cfg file | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
ref: ${{ github.event.repository.default_branch }} | ||
commit-message: "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}" | ||
github-username: ${{ secrets.github-username }} | ||
github-email: ${{ secrets.github-email }} | ||
github-token: ${{ secrets.github-token }} | ||
yannick-roeder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Create changelog | ||
id: build-changelog | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
|
@@ -77,15 +86,6 @@ jobs: | |
fetch-reviewers: "true" | ||
fetch-release-information: "true" | ||
|
||
- name: Commit and push changes including .bumpversion.cfg file | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
ref: ${{ github.event.repository.default_branch }} | ||
commit-message: "Bump version ${{ steps.bump-version.outputs.old-version }} → ${{ steps.bump-version.outputs.release-version }}" | ||
github-username: ${{ secrets.github-username }} | ||
github-email: ${{ secrets.github-email }} | ||
github-token: ${{ secrets.github-token }} | ||
|
||
- name: Tag and release | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
|
@@ -95,3 +95,19 @@ jobs: | |
github-token: ${{ secrets.github-token }} | ||
release-title: "${{ steps.bump-version.outputs.release-version }}" | ||
release-body: "${{ steps.build-changelog.outputs.single-changelog }}" | ||
|
||
- name: Bump to next snapshot version | ||
id: bump-version-snapshot | ||
uses: bakdata/ci-templates/actions/bump-version@feat/new-bumpversion | ||
with: | ||
release-type: ${{ inputs.release-type }} | ||
working-directory: ${{ inputs.working-directory }} | ||
|
||
- name: Commit and push changes including .bumpversion.cfg file | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
ref: ${{ github.event.repository.default_branch }} | ||
commit-message: "Bump version ${{ steps.bump-version-snapshot.outputs.release-version }} → ${{ steps.bump-version-snapshot.outputs.release-version }}" | ||
github-username: ${{ secrets.github-username }} | ||
github-email: ${{ secrets.github-email }} | ||
github-token: ${{ secrets.github-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,25 @@ | ||
name: "Bump version" | ||
description: "Bump version with python bump2version using .bumpversion.cfg" | ||
description: "Bump version with python bump-my-version using .bumpversion.cfg" | ||
# config example .bumpversion.cfg: | ||
# [bumpversion] | ||
# current_version = 1.0.0 | ||
# search = version: {current_version} | ||
# replace = version: {new_version} | ||
# parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<release>snapshot))? | ||
# serialize = | ||
# {major}.{minor}.{patch}-{release} | ||
# {major}.{minor}.{patch} | ||
|
||
# [bumpversion:part:release] | ||
# first_value = snapshot | ||
# optional_value = release | ||
# values = | ||
# snapshot | ||
# release | ||
Comment on lines
+3
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice that there is a comment here, ideally you can also put this in the docs |
||
|
||
inputs: | ||
release-type: | ||
description: "The type of the release (major, minor or patch)." | ||
description: "The type of the release (release, major, minor or patch). Release is a special case, where the snapshot suffix is removed." | ||
required: true | ||
working-directory: | ||
description: "The directory containing the `.bumpversion.cfg` file." | ||
|
@@ -25,20 +41,28 @@ outputs: | |
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up bump2version | ||
- name: Set up bump-my-version | ||
run: | | ||
pipx install bump2version | ||
pipx install bump-my-version | ||
shell: bash | ||
|
||
- name: Bump version | ||
id: bump-version | ||
run: | | ||
parameters=(--no-commit --no-tag ${{ inputs.release-type }}) | ||
echo "old-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" | ||
if [ -n "${{ inputs.new-version }}" ]; then | ||
yannick-roeder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
parameters+=(--new-version ${{ inputs.new-version }}) | ||
parameters=(--no-commit --allow-dirty --no-tag) | ||
echo "old-version=$(bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" | ||
|
||
if [[ ${{ inputs.new-version }} != "" ]]; then | ||
bump-my-version --new-version ${{ inputs.new-version }} | ||
else | ||
bump-my-version "${parameters[@]}" ${{ inputs.release-type }} | ||
fi | ||
bump2version "${parameters[@]}" | ||
echo "new-version=$(python -c "from configparser import ConfigParser; cfg = ConfigParser(); cfg.read('.bumpversion.cfg'); print(cfg['bumpversion']['current_version'])")" >> "$GITHUB_OUTPUT" | ||
echo "bump-my-version show current_version | tail -1)" >> "$GITHUB_OUTPUT" | ||
DerTiedemann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# release: a.b.c-snapshot -> a.b.c | ||
# release a.b.c -> crash | ||
# major: a.b.c(-snapshot)? -> a+1.0.0-snapshot | ||
# minor: a.b.c(-snapshot)? -> a.b+1.0-snapshot | ||
# patch: a.b.c(-snapshot)? -> a.b.c+1-snapshot | ||
# TLDR: release removes the snapshot suffix | ||
Comment on lines
+60
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, nice comments, but please also add it in the docs |
||
shell: bash | ||
working-directory: ${{ inputs.working-directory }} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: prebump version