-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (80 loc) · 3.18 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
name: Deploy and Update API Mgr
on:
push:
branches: [ main ]
env:
ANYPOINT_CLIENT_ID: ${{ secrets.CONNECTED_APP_CLIENT_ID }}
ANYPOINT_CLIENT_SECRET: ${{ secrets.CONNECTED_APP_CLIENT_SECRET }}
REST_API_ARTIFACT_ID: squirrel
API_MANAGER_API_ID: 19940258
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 17
- name: Publish to Exchange
run: |
mvn deploy --settings .maven/settings.xml -DskipMunitTests \
-Dclient.id="$ANYPOINT_CLIENT_ID" \
-Dclient.secret="$ANYPOINT_CLIENT_SECRET"
- name: Deploy to CloudHub 2.0
run: |
mvn deploy --settings .maven/settings.xml -DskipMunitTests -DmuleDeploy \
-Dclient.id="$ANYPOINT_CLIENT_ID" \
-Dclient.secret="$ANYPOINT_CLIENT_SECRET"
update-api-mgr:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 17
- name: Set up NodeJS 16
uses: actions/setup-node@v4
with:
node-version: 16
- name: Install Anypoint CLI
run: |
npm install -g anypoint-cli-v4
- name: Set ANYPOINT_ORG
run: |
echo "ANYPOINT_ORG=$(mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout)" >> $GITHUB_ENV
- name: Set ANYPOINT_ENV
run: |
echo "ANYPOINT_ENV=$(mvn help:evaluate -Dexpression=env -q -DforceStdout)" >> $GITHUB_ENV
- name: API Manager - Change specification version
run: |
restApiVersion=$(mvn dependency:list -DincludeArtifactIds=$REST_API_ARTIFACT_ID \
--settings .maven/settings.xml \
-DskipMunitTests \
-Dclient.id="$ANYPOINT_CLIENT_ID" \
-Dclient.secret="$ANYPOINT_CLIENT_SECRET" | grep ":$REST_API_ARTIFACT_ID:" | grep -Eo "[0-9]+[.][0-9]+[.][0-9]+")
anypoint-cli-v4 api-mgr:api:change-specification $API_MANAGER_API_ID $restApiVersion
- name: API Manager - Update implementation URI
run: |
appName=$(mvn help:evaluate -Dexpression=project.name -q -DforceStdout)
appId=$(anypoint-cli-v4 runtime-mgr:application:list --output json | jq '.[]|select(.name=="'"$appName"'").id' | grep -Eo '[^"].+[^"]')
appUri=$(anypoint-cli-v4 runtime-mgr:application:describe --output json $appId | jq '.target.deploymentSettings.http.inbound.publicUrl' | grep -Eo '[^"].+[^"]')
anypoint-cli-v4 api-mgr:api:edit --uri $appUri $API_MANAGER_API_ID