-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (89 loc) · 3.13 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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Mulesoft Package
on:
push:
branches:
- "main"
tags:
- "v*"
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
ORGANIZATION_ID: ${{ secrets.ORGANIZATION_ID }}
ENVIRONMENT: Sandbox
APP_ID: cicd-integration
EXCHANGE_VERSION: v0.0.0
REPO_NAME: unknow
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Verify Client Credentials
run: |
curl -Lfsi -X POST https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token -H 'Content-Type: application/json' \
-d '{"grant_type":"client_credentials","client_id":"${{ env.CLIENT_ID }}","client_secret":"${{ env.CLIENT_SECRET }}"}'
- name: Checkout scdp-cicd-integation
uses: actions/checkout@v3
- name: Checkout mulesoft-scgp-api
uses: actions/checkout@v3
with:
repository: dvgamerr/scgp-mule-domain
path: ./mule-domain
ref: main
- name: Convert pom.xml to json
uses: fabasoad/data-format-converter-action@main
id: convert
with:
input: ./pom.xml
from: xml
to: json
- name: Set Environment Name
run: |
version=v$(echo '${{ steps.convert.outputs.output }}' | jq -r '.project.dependencies.dependency[] | select(.groupId == "${{ env.ORGANIZATION_ID }}") | .version')
repo_name=${GITHUB_REPOSITORY#*/}#${{ github.run_number }}-$version-build.${{ github.ref_name }}#${{ github.run_id }}
echo "EXCHANGE_VERSION=$version" >> $GITHUB_ENV
echo "REPO_NAME=$repo_name" >> $GITHUB_ENV
- name: Setup jdk8
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build mule-domain
run: |
cd ./mule-domain
mvn clean package install -f pom.xml
- name: Build scdp-cicd-integation
run: |
mvn clean package -f pom.xml -s settings.xml
mv $(ls ./target/*.jar) ./target/${{ env.REPO_NAME }}.jar
ls -al ./target/*.jar
- name: Upload artifact package
# if: github.ref_name != "main"
uses: actions/upload-artifact@v3
with:
name: ${{ env.REPO_NAME }}
path: ./target/${{ env.REPO_NAME }}.jar
# deploy:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: Download artifact package
# uses: actions/download-artifact@v3
# with:
# name: ${{ env.REPO_NAME }}
- name: Install anypoint-cli-v4 and Config
run: |
npm i -g anypoint-cli-v4
anypoint-cli-v4 conf client_id ${{ env.CLIENT_ID }}
anypoint-cli-v4 conf client_secret ${{ env.CLIENT_SECRET }}
anypoint-cli-v4 conf organization ${{ env.ORGANIZATION_ID }}
anypoint-cli-v4 conf environment ${{ env.ENVIRONMENT }}
- name: Deploy Aticatct to CouldAppilication
run: |
anypoint-cli-v4 runtime-mgr:cloudhub-application:modify \
${{ env.APP_ID }} ./target/${{ env.REPO_NAME }}.jar -o json