Skip to content

[90374] update github workflows to use github actions v4 #280

[90374] update github workflows to use github actions v4

[90374] update github workflows to use github actions v4 #280

Workflow file for this run

name: ci-master
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v4
env:
cache-name: m2
with:
path: ~/.m2/repository
key: ${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ env.cache-name }}-
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
- name: environment
run: |
sudo apt-get install --yes --no-install-recommends libxml-xpath-perl
export VERSION=$(xpath -q -e "/project/version/text()" pom.xml)
export VERSION=${VERSION//-SNAPSHOT}-$(git rev-parse --short ${GITHUB_SHA})
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo ${GITHUB_SHA} > github_sha256
- name: mvn version
run: mvn --batch-mode versions:set -DgenerateBackupPoms=false -DnewVersion=${VERSION}
- name: mvn deploy
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: mvn sonar
run: |
mvn --batch-mode verify sonar:sonar \
-Dsonar.login=${SONAR_TOKEN} \
-Dsonar.host.url=${SONAR_URL} \
-Dsonar.organization=${GITHUB_REPOSITORY_OWNER} \
-Dsonar.projectKey=${GITHUB_REPOSITORY/\//_}
env:
SONAR_URL: https://sonarcloud.io
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: CORONA_TRACING_BACKEND001_TST-TEST
path: /home/runner/work/efgs-federation-gateway/efgs-federation-gateway/target/CORONA_TRACING_BACKEND001_TST*
- uses: actions/upload-artifact@v4
with:
name: CORONA_TRACING_BACKEND001_ACC-ACCEPTANCE
path: /home/runner/work/efgs-federation-gateway/efgs-federation-gateway/target/CORONA_TRACING_BACKEND001_ACC*
- uses: actions/upload-artifact@v4
with:
name: CORONA_TRACING_BACKEND001_PRD-PROD
path: /home/runner/work/efgs-federation-gateway/efgs-federation-gateway/target/CORONA_TRACING_BACKEND001_PRD*
- name: mvn clean install -P docker
run: mvn clean install -P docker
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Build docker image
run: docker build target/docker --file target/docker/Dockerfile --tag docker.pkg.github.com/${{ github.repository }}/backend:latest
- name: Push docker image
run: docker push docker.pkg.github.com/${{ github.repository }}/backend:latest