Skip to content

Merge pull request #202 from AmericaSCORESBayArea/docs/201-new-runnin… #103

Merge pull request #202 from AmericaSCORESBayArea/docs/201-new-runnin…

Merge pull request #202 from AmericaSCORESBayArea/docs/201-new-runnin… #103

# This workflow will build a MuleSoft project and deploy to CloudHub
name: Build and Deploy to Sandbox
on:
push:
branches: [ master ]
workflow_dispatch:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
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@v1
with:
java-version: 1.8
- name: Add repo credentials
uses: s4u/[email protected]
with:
servers: |
[{
"id": "mule-enterprise",
"username": "${{ secrets.mule_nexus_username }}",
"password": "${{ secrets.mule_nexus_password }}"
},
{
"id": "scores-exchange",
"username": "${{ secrets.anypoint_cicd_username }}",
"password": "${{ secrets.anypoint_cicd_password }}"
}]
- name: Print effective-settings
run: mvn help:effective-settings
- name: Print effective-pom
run: mvn help:effective-pom
- name: Build with Maven
run: mvn -B package --file pom.xml
- 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@master
with:
name: artifacts
path: target/*.jar
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/download-artifact@master
with:
name: artifacts
- name: Print effective-settings
run: mvn help:effective-settings
- name: Deploy to Sandbox
env:
USERNAME: ${{ secrets.anypoint_cicd_username }}
PASSWORD: ${{ secrets.anypoint_cicd_password }}
SFDC_TKN: ${{ secrets.sfdc_tkn }}
SFDC_PASSWORD: ${{ secrets.sfdc_sandbox_integrationuser_pwd }}
TYPEFORM_CLIENTID: ${{ secrets.typeform_clientid }}
TYPEFORM_CLIENTSECRET: ${{ secrets.typeform_clientsecret }}
TYPEFORM_TKN: ${{ secrets.typeform_tkn }}
run: |
artifactName=$(ls *.jar | head -1)
mvn deploy -DmuleDeploy -e -Dmule.artifact=$artifactName -Danypoint.username="$USERNAME" -Danypoint.password="$PASSWORD" -Denv=Sandbox -Denv.lowercase=sandbox -Dsfdc.password="$SFDC_PASSWORD" -Dtypeform.clientid="$TYPEFORM_CLIENTID" -Dtypeform.clientsecret="$TYPEFORM_CLIENTSECRET" -Dtypeform.tkn="$TYPEFORM_TKN" -Dsfdc.tkn="$SFDC_TKN" -DskipTests