Skip to content

Commit

Permalink
Merge pull request #1 from alexandramartinez/test
Browse files Browse the repository at this point in the history
Test to Main
  • Loading branch information
alexandramartinez authored Oct 1, 2024
2 parents 0cec1b0 + cf5072e commit 825356e
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 38 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/build.yml

This file was deleted.

83 changes: 83 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>8ee07573-4230-4e12-b0c1-6f824217216f</groupId>
<artifactId>squirrel-app</artifactId>
<version>1.1.0</version>
<version>1.1.2</version>
<packaging>mule-application</packaging>
<name>squirrel-app</name>
<properties>
Expand Down Expand Up @@ -106,6 +106,11 @@
<version>1.9.2</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.0</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
Expand Down

0 comments on commit 825356e

Please sign in to comment.