Update build.yml #17
Workflow file for this run
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
name: Build | |
'on': | |
push: | |
branches: | |
- '*' | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Check Commit Message | |
run: | | |
if [[ "${{ github.event.head_commit.message }}" == *"Submit project save commit"* ]]; then | |
echo 'Submit project save commit executed!' | |
else | |
echo 'Commit message does not contain "Submit project save commit". Exiting...' | |
exit 1 | |
fi | |
- name: Move Pom.xml to Root | |
run: mv .github/workflows/pom.xml ./pom.xml | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: badabeeddcc309774475bedbafbeeacbbathree | |
SONAR_TOKEN: 811c9a490983734401ba4e491eaefc8bfa7281de | |
run: >- | |
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar | |
-Dsonar.projectKey=iamneo-production_badabeeddcc309774475bedbafbeeacbbathree | |
-Dsonar.login=811c9a490983734401ba4e491eaefc8bfa7281de | |
- name: Trigger API | |
if: always() | |
env: | |
API_URL: '${{ secrets.API_URL }}' | |
API_SECRET: '${{ secrets.API_SECRET }}' | |
run: > | |
REPO_NAME=$(echo "${GITHUB_REPOSITORY}" | cut -d '/' -f 2) | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
API_PAYLOAD="{ \"repo_id\": \"$REPO_NAME\", \"branch_name\": | |
\"$BRANCH_NAME\", \"api_secret\": \"$API_SECRET\" }" | |
curl -X POST -H "Content-Type: application/json" -d "$API_PAYLOAD" | |
$API_URL |