-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (44 loc) · 1.55 KB
/
build.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
name: Build and release
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
if: "startsWith(github.event.head_commit.message, 'Release: ')"
steps:
- uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Get app version
id: app_version
run: echo "APP_VERSION=$(./gradlew version --no-daemon --console=plain -q | tail -n 1)" >> $GITHUB_OUTPUT
- name: Check release with local version
if: "github.event.head_commit.message != format('Release: {0}', steps.app_version.outputs.APP_VERSION)"
run: |
echo 'Local version doesn't match commit version'
exit 1
- name: Run test
run: ./gradlew test
- name: Create release in artifactory
env:
REPOSITORY_USERNAME: ${{ secrets.REPOSITORY_USERNAME }}
REPOSITORY_PASSWORD: ${{ secrets.REPOSITORY_PASSWORD }}
run: |
./gradlew clean
./gradlew assembleRelease assembleReleaseUnitTest
./gradlew artifactoryPublish \
-PrepositoryUserName=${{ env.REPOSITORY_USERNAME }} \
-PrepositoryPassword=${{ env.REPOSITORY_PASSWORD }}
- name: Create GH release
env:
APP_VERSION: ${{ steps.app_version.outputs.APP_VERSION }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v$APP_VERSION" \
-t "v$APP_VERSION" \
-n 'Check [CHANGELOG](./CHANGELOG.md)'