Skip to content

edit

edit #251

Workflow file for this run

name: CI/CD
on:
pull_request:
branches: main
types: [opened, synchronize, reopened]
push:
branches: main
paths-ignore: [ "README.md", "doc/**" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin' #Eclipse Temurin
- name: Verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn --batch-mode --no-transfer-progress verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=oneteme_${{ github.event.repository.name }}
- name: Extract version
id: mvnVer
run: echo "version=$(mvn help:evaluate -DforceStdout -Dexpression=project.version -q)" >>$GITHUB_OUTPUT
outputs:
version: ${{ steps.mvnVer.outputs.version }}
deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref_name == 'main' && endsWith(needs.build.outputs.version, '-SNAPSHOT')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin' #Eclipse Temurin
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Deploy ${{ needs.build.outputs.version }}
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: mvn --no-transfer-progress --batch-mode clean deploy