This commit is contained in:
Marko Frankovic 2025-02-26 15:41:41 +01:00
parent 4d385ff4ff
commit cab0bebf23
2 changed files with 116 additions and 0 deletions

59
.github/workflows/maven-publish.yml vendored Normal file
View File

@ -0,0 +1,59 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Maven Publish
on:
workflow_call:
secrets:
AWS_CA_USER:
required: true
AWS_CA_PASSWORD:
required: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: '3.9.9'
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
cache: maven
- name: Set up AWS Cli
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip -q awscliv2.zip
./aws/install
export TOKEN=`aws codeartifact get-authorization-token --region eu-west-1 --domain pravila --domain-owner 867459752380 --query authorizationToken --output text`
echo "CODEARTIFACT_AUTH_TOKEN=$TOKEN" >> $GITHUB_ENV
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CA_USER }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CA_PASSWORD }}
- name: Build with Maven
run: mvn -B clean package --file pom.xml -s mvn-settings.xml
- name: Deploy artifacts
run: |
echo "CodeArtifact token: $CODEARTIFACT_AUTH_TOKEN"
mvn deploy --file pom.xml -s mvn-settings.xml -DrepositoryId=deploy
env:
GITHUB_TOKEN: ${{ github.token }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CA_USER }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CA_PASSWORD }}

57
.github/workflows/maven.yml vendored Normal file
View File

@ -0,0 +1,57 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
workflow_call:
secrets:
AWS_CA_USER:
required: true
AWS_CA_PASSWORD:
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: '3.9.9'
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
- name: Set up AWS Cli
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip -q awscliv2.zip
./aws/install
export TOKEN=`aws codeartifact get-authorization-token --region eu-west-1 --domain pravila --domain-owner 867459752380 --query authorizationToken --output text`
echo "CODEARTIFACT_AUTH_TOKEN=$TOKEN" >> $GITHUB_ENV
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CA_USER }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CA_PASSWORD }}
- name: Build with Maven
run: mvn -B clean package -s mvn-settings.xml
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CA_USER }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CA_PASSWORD }}
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
# - name: Update dependency graph
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6