Skip to content

Commit be8858d

Browse files
authored
Create release.yml
1 parent 7b2d1f8 commit be8858d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/release.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish-release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout latest code
13+
uses: actions/checkout@v2
14+
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
20+
- name: Setup build cache
21+
uses: actions/cache@v1
22+
with:
23+
path: ~/.m2/repository
24+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
25+
restore-keys: |
26+
${{ runner.os }}-maven-
27+
- name: Publish artifact
28+
29+
# The GITHUB_REF tag comes in the format 'refs/tags/xxx'.
30+
# So if we split on '/' and take the 3rd value, we can get the release name.
31+
run: |
32+
REPO_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}')
33+
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
34+
echo "-- Setting new release version ${NEW_VERSION} for ${REPO_NAME} --"
35+
mvn -B versions:set -DnewVersion="${NEW_VERSION}" -DgenerateBackupPoms=false
36+
echo "-- Build, test and deploy release to GPR --"
37+
mvn -B --settings .m2/settings.xml clean deploy -Dmaven.wagon.http.pool=false

0 commit comments

Comments
 (0)