Skip to content

Instantly share code, notes, and snippets.

@wangsha
Last active November 14, 2022 18:30
Show Gist options
  • Save wangsha/92f46a31c1a89f505940ef6c982b4f6d to your computer and use it in GitHub Desktop.
Save wangsha/92f46a31c1a89f505940ef6c982b4f6d to your computer and use it in GitHub Desktop.
Automatic create release from master branch for python package.
#!/bin/bash
# create release from master branch
# v1.0.0, v1.5.2, etc.
versionLabel=$(grep -i '^__version__ = ' setup.py | cut -d "'" -f2)
# establish branch and tag name variables
devBranch=development
stageBranch=stage
masterBranch=master
releaseBranch=releases/$versionLabel
echo "creating release branch $releaseBranch"
# create the release branch from the master branch
git checkout -b $releaseBranch $masterBranch
# merge release branch with the new version number back into stage
git checkout $stageBranch
git merge --no-ff $releaseBranch -m 'automated merge with release branch. [ci skip]'
# merge release branch with the new version number back into develop
git checkout $devBranch
git merge --no-ff $releaseBranch -m 'automated merge with release branch. [ci skip]'
# push all to origin
git push origin --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment