-
Notifications
You must be signed in to change notification settings - Fork 5
60 lines (55 loc) · 1.83 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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 }}"