choeCreate CODEOWNERS #7
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: maven-release | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 for deploy to S3 bucket | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
cache: maven | |
- uses: whelk-io/maven-settings-xml-action@v20 | |
with: | |
repositories: > | |
[ | |
{ | |
"id": "s3", | |
"name": "s3.sbb.polarion.maven.repo", | |
"url": "s3://sbb-polarion-maven-repo/polarion.mvn", | |
"releases": { | |
"enabled": "true", | |
"updatePolicy": "never" | |
} | |
} | |
] | |
servers: > | |
[ | |
{ | |
"id": "s3", | |
"username": "${{ secrets.S3_SBB_POLARION_MAVEN_REPO_RW_ACCESS_KEY }}", | |
"password": "${{ secrets.S3_SBB_POLARION_MAVEN_REPO_RW_SECRET_ACCESS_KEY }}" | |
}, | |
{ | |
"id": "github", | |
"username": "${env.GITHUB_ACTOR}", | |
"password": "${env.GITHUB_TOKEN}" | |
} | |
] | |
active_profiles: > | |
[ | |
"github" | |
] | |
- run: cat /home/runner/.m2/settings.xml | |
- name: Build with Maven | |
run: mvn --batch-mode clean package | |
- name: Extract artefact version | |
id: artefact_version | |
run: echo ::set-output name=version::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
- name: Publish to S3 bucket | |
if: ${{ !endsWith(steps.artefact_version.outputs.version, '-SNAPSHOT') }} | |
run: mvn --batch-mode deploy -Ps3Deploy | |
- name: Publish to GitHub Packages | |
if: ${{ !endsWith(steps.artefact_version.outputs.version, '-SNAPSHOT') }} | |
run: mvn --batch-mode deploy -PgithubDeploy | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |