-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5484e8
commit 5627506
Showing
3 changed files
with
83 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,38 @@ | ||
name: Build and Deploy to Sandbox | ||
name: Publish to Exchange & Deploy to CH2.0 | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
branches: [ cloudhub2 ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout this repo | ||
uses: actions/checkout@v3 | ||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 8 | ||
- name: Test with Maven | ||
env: | ||
nexus_username: ${{ secrets.nexus_username }} | ||
nexus_password: ${{ secrets.nexus_password }} | ||
KEY: ${{ secrets.decryption_key }} | ||
run: mvn test --settings .maven/settings.xml -Dsecure.key="$KEY" | ||
- name: Upload MUnit reports | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: munit-test-reports | ||
path: target/site/munit/coverage/ | ||
|
||
jobs: | ||
build: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout this repo | ||
uses: actions/checkout@v3 | ||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 8 | ||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml -DskipMunitTests | ||
- 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: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifacts | ||
path: target/*.jar | ||
|
||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout this repo | ||
uses: actions/checkout@v3 | ||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifacts | ||
- name: Deploy to Sandbox | ||
env: | ||
USERNAME: ${{ secrets.anypoint_platform_username }} | ||
PASSWORD: ${{ secrets.anypoint_platform_password }} | ||
KEY: ${{ secrets.decryption_key }} | ||
run: | | ||
artifactName=$(ls *.jar | head -1) | ||
mvn deploy -DskipMunitTests -DmuleDeploy \ | ||
-Dmule.artifact=$artifactName \ | ||
-Danypoint.username="$USERNAME" \ | ||
-Danypoint.password="$PASSWORD" \ | ||
-Ddecryption.key="$KEY" | ||
- 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 1.8 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "zulu" | ||
java-version: 8 | ||
|
||
- name: Publish to Exchange | ||
run: | | ||
mvn deploy --settings .maven/settings.xml -DskipMunitTests \ | ||
-Dclient.id="${{ secrets.CONNECTED_APP_CLIENT_ID }}" \ | ||
-Dclient.secret="${{ secrets.CONNECTED_APP_CLIENT_SECRET }}" | ||
- name: Deploy to CloudHub 2.0 | ||
run: | | ||
mvn deploy --settings .maven/settings.xml -DskipMunitTests -DmuleDeploy \ | ||
-Dclient.id="${{ secrets.CONNECTED_APP_CLIENT_ID }}" \ | ||
-Dclient.secret="${{ secrets.CONNECTED_APP_CLIENT_SECRET }}" | ||
-Ddecryption.key="${{ secrets.DECRYPTION_KEY }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters