Skip to content

Commit

Permalink
chore(github actions): maven-release deploys to s3 and github packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ariwk authored Oct 19, 2023
1 parent 90b9fe8 commit b2a2c72
Showing 1 changed file with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
name: Create package on push to main

---
name: maven-release
on:
push:
branches:
- main
- feature/**

branches: [main]
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- name: Set up JDK 17 for deploy to S3 bucket
uses: actions/setup-java@v3
with:
distribution: 'adopt'
distribution: adopt
java-version: 17
cache: 'maven'
cache: maven
- uses: whelk-io/maven-settings-xml-action@v20
with:
repositories: >
Expand All @@ -28,10 +25,6 @@ jobs:
"releases": {
"enabled": "true",
"updatePolicy": "never"
},
"snapshots": {
"enabled": "true",
"updatePolicy": "always"
}
}
]
Expand All @@ -41,6 +34,11 @@ jobs:
"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: >
Expand All @@ -49,7 +47,15 @@ jobs:
]
- run: cat /home/runner/.m2/settings.xml
- name: Build with Maven
run: mvn -B clean package
- name: Deploy with Maven (main)
if: github.ref == 'refs/heads/main'
run: mvn -B deploy
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 }}

0 comments on commit b2a2c72

Please sign in to comment.