sonar #154
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: Release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
Release: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: "oracle" | |
java-version: "21" | |
check-latest: true | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Docker compose | |
run: docker-compose up -d | |
- name: Sleeping | |
run: sleep 45 | |
- name: Publish package | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
mvn --batch-mode deploy org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ | |
-Dsonar.host.url="https://sonarcloud.io" \ | |
-Dsonar.organization=memoria-io \ | |
-Dsonar.projectKey=memoria-io_atom | |
- name: Get Maven project version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
MAVEN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo $MAVEN_VERSION | |
echo "MAVEN_VERSION=$MAVEN_VERSION" >> $GITHUB_ENV | |
- name: Create tag | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: 'refs/tags/${{ env.MAVEN_VERSION }}', | |
sha: context.sha | |
}) |