-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (70 loc) · 2.72 KB
/
main.yaml
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
70
71
72
73
74
75
76
77
78
on:
push:
branches:
- main
jobs:
record-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: "11"
cache: "maven"
distribution: "zulu"
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Retrieving version
run: |
VERSION_FORMAT='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}'
mvn -q build-helper:parse-version versions:set -DnewVersion="${VERSION_FORMAT}" versions:commit
echo "VERSION=$(grep \<version\> pom.xml | xargs | awk -F '[<>]' '{ print $3}')" >> $GITHUB_ENV
- name: Releasing
run: |
echo "################### using version: v$VERSION ###################"
# tag repo
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
git tag -a v"${VERSION}" -m "Release by Github Actions v${{ env.VERSION }}"
git push origin v"${{ env.VERSION }}"
- name: Bumping version
run: |
# bumping it to a new snapshot release:
# shellcheck disable=SC2016
VERSION_FORMAT='${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.${parsedVersion.incrementalVersion}-SNAPSHOT'
mvn -q build-helper:parse-version versions:set -DnewVersion="${VERSION_FORMAT}" versions:commit
VERSION=$(grep \<version\> pom.xml | xargs | awk -F '[<>]' '{ print $3}')
echo "next version is: $VERSION"
#commit version change
git status
git commit -a -m "bump to ${VERSION} [ci skip]"
git push origin main
deploy-production-us:
if: "!contains(github.event.commits[0].message, '[ci skip]')"
runs-on: ubuntu-latest
needs: [ record-release ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: "11"
cache: "maven"
distribution: "zulu"
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Deploy
run: ./.github/workflows/deploy.sh