-
Notifications
You must be signed in to change notification settings - Fork 5
43 lines (39 loc) · 1.34 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
name: Build and Deploy
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CLOUDHUB_APP_PREFIX: ${{ vars.CLOUDHUB_APP_PREFIX }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: ./mvnw -ntp -B package --file pom.xml -DskipMunitTests -DCLOUDHUB_APP_PREFIX=${CLOUDHUB_APP_PREFIX}
- name: Stamp artifact file name with commit hash
run: |
artifactName1=$(ls target/*.jar | head -1)
commitHash=$(git rev-parse --short "$GITHUB_SHA")
artifactName2=$(ls target/*.jar | head -1 | sed "s/.jar/-$commitHash.jar/g")
mv $artifactName1 $artifactName2
- name: Deploy to Sandbox
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
env:
USERNAME: ${{ secrets.anypoint_platform_username }}
PASSWORD: ${{ secrets.anypoint_platform_password }}
run: |
artifactName=$(ls target/*.jar | head -1)
./mvnw -ntp -B mule:deploy \
-Dmule.artifact=$artifactName \
-Danypoint.username="$USERNAME" \
-Danypoint.password="$PASSWORD" \
-DCLOUDHUB_APP_PREFIX=${CLOUDHUB_APP_PREFIX}