-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
3 changed files
with
82 additions
and
2 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,60 @@ | ||
name: Cut release automatically | ||
|
||
on: | ||
schedule: | ||
- cron: "0 16 * * 2" | ||
|
||
jobs: | ||
check-changes: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
ref: master | ||
- name: Check commits since last release | ||
id: count-commits | ||
run: | | ||
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
commits_since=$(git log $(git describe --tags --always --abbrev=0)..HEAD --oneline | wc -l) | ||
echo "Commits since last release: $commits_since" | ||
if [ "${commits_since}" == "0" ]; then | ||
echo "No release needed" | ||
exit 1 | ||
else | ||
echo "Release needed" | ||
fi | ||
bump-and-pull-request: | ||
needs: check-changes | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: master | ||
- name: Bump version | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
- run: | | ||
pip install -r $GITHUB_WORKSPACE/requirements/release.txt | ||
newver=$(bumpversion --dry-run --list patch | grep new_version= | sed -r s,"^.*=",,) | ||
echo "::set-env name=NEW_VERSION::$newver" | ||
echo "New version will be ${{ env.NEW_VERSION }}" | ||
bumpversion patch | ||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: autorelease/${{ env.NEW_VERSION }} | ||
commit-message: Release version ${{ env.NEW_VERSION }} | ||
title: Release version ${{ env.NEW_VERSION }} | ||
body: This is an automated release that updates dependencies. | ||
- name: Show outputs | ||
run: | | ||
echo "Pull Request Number - ${{ steps.cpr.outputs.pr_number }}" |
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,2 @@ | ||
pip==20.0.2 | ||
bumpversion==0.5.3 |