Skip to content

Commit

Permalink
Merge pull request #126 from YakDriver/autorelease
Browse files Browse the repository at this point in the history
Add automatic release structure
  • Loading branch information
YakDriver authored Feb 3, 2020
2 parents 9fb4426 + 776d57b commit 946fde9
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
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 }}"
22 changes: 20 additions & 2 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pull_request_rules:
- name: automatic approve dependabot pull requests
- name: automatically approve dependabot pull requests
conditions:
- author~=dependabot\[bot\]|dependabot-preview\[bot\]
- status-success=continuous-integration/appveyor/branch
Expand All @@ -10,10 +10,28 @@ pull_request_rules:
review:
type: APPROVE

- name: automatic merge for dependabot pull requests
- name: automatically merge dependabot pull requests
conditions:
- author~=dependabot\[bot\]|dependabot-preview\[bot\]
- "#approved-reviews-by>=1"
actions:
merge:
method: merge

pull_request_rules:
- name: automatically approve gha-bot pull requests
conditions:
- author~=github-actions\[bot\]
- status-success=continuous-integration/appveyor/pr
- status-success=continuous-integration/travis-ci/pr
actions:
review:
type: APPROVE

- name: automatically merge gha-bot pull requests
conditions:
- author~=github-actions\[bot\]
- "#approved-reviews-by>=1"
actions:
merge:
method: merge
2 changes: 2 additions & 0 deletions requirements/release.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pip==20.0.2
bumpversion==0.5.3

0 comments on commit 946fde9

Please sign in to comment.