-
Notifications
You must be signed in to change notification settings - Fork 9
69 lines (67 loc) · 2.38 KB
/
release_version.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
61
62
63
64
65
66
67
68
69
on:
release:
types: [published]
name: Release version
jobs:
build:
name: Release version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Prepare props
id: props
run: |
export VERSION=$(sed -n '1s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p' gradle.properties)
echo "::set-output name=current_version::$VERSION"
export NEXT_VERSION=$(echo $VERSION | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
echo "::set-output name=next_ver::$NEXT_VERSION"
- name: Build app
run: |
./gradlew --stacktrace -i -x :cogboard-app:test
- name: Publish App to DockerHub
if: ${{ success() }}
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: cogboard/cogboard-app
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "${{ steps.props.outputs.current_version }},latest"
workdir: build
- name: Publish Webapp to DockerHub
if: ${{ success() }}
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: cogboard/cogboard-web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "${{ steps.props.outputs.current_version }},latest"
workdir: cogboard-webapp
- name: Bump Version
if: ${{ success() }}
id: bump_version
run: |
sed -i "1s%version=.*%version=${{ steps.props.outputs.next_ver }}%g" gradle.properties
- name: Commit files
if: ${{ success() }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout master
git pull
git commit -m "[skip travis] Bump version" -a
- name: Push Changes
if: ${{ success() }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create draft release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.props.outputs.next_ver }}
release_name: ${{ steps.props.outputs.next_ver }}
draft: true
prerelease: false