Skip to content

Cut release automatically #63

Cut release automatically

Cut release automatically #63

Workflow file for this run

name: Cut release automatically
on:
schedule:
- cron: "0 14 25 * *"
jobs:
check-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
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@v4
with:
ref: master
- name: Bump version
uses: actions/setup-python@v5
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 "NEW_VERSION=${newver}" >> $GITHUB_ENV
echo "New version will be ${newver}"
bumpversion patch
- name: Create Pull Request
id: cpr
uses: peter-evans/[email protected]
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.pull-request-number }}"