Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
LT-Linas35 authored Sep 6, 2024
1 parent d533bcd commit 7e7993c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Sonar Cloud Scanner Release and Trigger build Docker image workflow

on:
release:
types:
- published

jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectKey=LT-Linas35_nextcloud_server
-Dsonar.organization=lt-linas35
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.cfamily.enabled=false
-Dsonar.c.file.suffixes=-
-Dsonar.cpp.file.suffixes=-
-Dsonar.objc.file.suffixes=-
-Dsonar.qualitygate.wait=true
- name: Check Quality Gate status
run: |
if [ "$(sonar-quality-gate status)" != "OK" ]; then
echo "Quality gate failed!"
exit 1
fi
- name: Trigger build Docker image workflow
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.workflow_token }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/LT-Linas35/final_project/actions/workflows/docker-production.yml/dispatches \
-d '{"ref":"main"}'

0 comments on commit 7e7993c

Please sign in to comment.