-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (44 loc) · 1.53 KB
/
build-deploy.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
name: Build-Deploy
on:
push:
branches:
- main
jobs:
build-and-deploy-artifact:
name: Build and deploy to github package
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
id: setup-java
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Use Maven v3.8.7
uses: stCarolas/[email protected]
with:
maven-version: 3.8.7
- name: Resolve/Update Dependencies
env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn package dependency:resolve-plugins dependency:go-offline
- name: Build (and run tests)
if: steps.setup-java.outputs.cache-hit != 'true'
run: mvn clean install
- name: Setting version
run: |
export GIT_COMMIT_HASH=$(git log -n 1 --pretty=format:'%h')
export GIT_COMMIT_DATE=$(git log -1 --pretty='%ad' --date=format:'%Y%m%d%H%M%S')
export VERSION=1.0_${GIT_COMMIT_DATE}_${GIT_COMMIT_HASH}
echo "Setting version $VERSION"
mvn versions:set -DnewVersion="$VERSION"
mvn versions:commit
- name: Deploy to Github Package
env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn --settings .github/maven-settings.xml source:jar-no-fork deploy -DskipTests=true -Dmaven.wagon.http.pool=false