-
Notifications
You must be signed in to change notification settings - Fork 113
42 lines (42 loc) · 1.63 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
# Whenever a commit is pushed with a non-snapshot version (no "-SNAPSHOT" suffix), this job will create a new
# GitHub release. Additionally, it will increment the version by one patch level, append a "-SNAPSHOT" suffix, and
# commit + push it (e.g., "2.3.4" -> "2.3.5-SNAPSHOT").
name: Release and Update
on:
push:
branches:
- 'master'
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Read Version
id: read-version
run: |
version=`cat gradle.properties | sed -n "s/^.*version\s*=\s*\(\S*\).*$/\1/p"`
echo "::set-output name=version::$version"
- name: Create Release
if: ${{ !endsWith(steps.read-version.outputs.version, 'SNAPSHOT') }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.read-version.outputs.version }}
release_name: Release ${{ steps.read-version.outputs.version }}
body: |
Version ${{ steps.read-version.outputs.version }}
draft: true
prerelease: false
- name: Update Version
if: ${{ !endsWith(steps.read-version.outputs.version, 'SNAPSHOT') }}
run: |
./gradlew test incrementVersion
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add gradle.properties
git commit -am "Increment patch version and append -SNAPSHOT suffix"
git push