Update actions/upload-artifact action to v4.6.0 #38
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 and push | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
maven-verify: | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Cache Maven dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
${{ runner.os }}-maven- | |
- name: Run maven build | |
run: mvn verify | |
- uses: actions/[email protected] | |
with: | |
path: target/*.jar | |
- name: Sonar Scan | |
env: | |
SONAR_TOKEN: ${{ secrets.ENTUR_SONAR_PASSWORD }} | |
SONAR_PROJECT_NAME: ${{ github.event.repository.name }} | |
SONAR_PROJECT_KEY: entur_${{ github.event.repository.name }} | |
run: | | |
mvn | |
org.jacoco:jacoco-maven-plugin:prepare-agent verify \ | |
org.jacoco:jacoco-maven-plugin:report sonar:sonar \ | |
-Dmaven.main.skip \ | |
-DskipTests \ | |
-Dsonar.projectKey=${SONAR_PROJECT_KEY} \ | |
-Dsonar.organization=enturas-github \ | |
-Dsonar.projectName=${SONAR_PROJECT_NAME} \ | |
-Dsonar.host.url=https://sonarcloud.io \ | |
-Dsonar.login=${SONAR_TOKEN} | |
docker-build: | |
needs: [maven-verify] | |
uses: entur/gha-docker/.github/workflows/build.yml@v1 | |
with: | |
build_artifact_name: artifact | |
build_artifact_path: target | |
docker-push: | |
if: github.repository_owner == 'entur' && github.event_name == 'push' | |
needs: [docker-build] | |
uses: entur/gha-docker/.github/workflows/push.yml@v1 |