Deploy artifact by hand

This commit is contained in:
Marko Frankovic 2025-03-20 15:09:25 +01:00
parent 5c799eb089
commit 13a75cc5f7

View File

@ -41,7 +41,6 @@ jobs:
with: with:
java-version: '21' java-version: '21'
distribution: 'corretto' distribution: 'corretto'
cache: maven
- name: Set up JDK from ENV - name: Set up JDK from ENV
if: github.ref != 'refs/heads/feature/T2900-java21' && github.ref != 'refs/heads/feature/T2900-java-21' if: github.ref != 'refs/heads/feature/T2900-java21' && github.ref != 'refs/heads/feature/T2900-java-21'
@ -49,7 +48,6 @@ jobs:
with: with:
java-version: '${{ secrets.JAVA_VERSION }}' java-version: '${{ secrets.JAVA_VERSION }}'
distribution: 'corretto' distribution: 'corretto'
cache: maven
- name: Create Maven settings - name: Create Maven settings
run: | run: |
@ -57,9 +55,26 @@ jobs:
env: env:
SETTINGS_XML: ${{ secrets.MVN_SETTINGS_XML }} SETTINGS_XML: ${{ secrets.MVN_SETTINGS_XML }}
- name: Build and deploy artifacts - name: Deploy artifacts
run: | run: |
mvn clean deploy -U --file pom.xml -DskipTests -DrepositoryId=pravila--pravila-maven mvn clean deploy -U --file pom.xml -DrepositoryId=pravila--pravila-maven
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
CODEARTIFACT_AUTH_TOKEN: ${{ secrets.AWS_CA_TOKEN }} CODEARTIFACT_AUTH_TOKEN: ${{ secrets.AWS_CA_TOKEN }}
- name: Upload snapshot to nexus
if: github.ref != 'refs/heads/feature/T2900-java21'
run: |
GROUP_ID=$(mvn help:evaluate -Dexpression="project.groupId" -q -DforceStdout)
ARTIFACT_ID=$(mvn help:evaluate -Dexpression="project.artifactId" -q -DforceStdout)
VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
echo "Uploading artifact for $GROUP_ID:$ARTIFACT_ID:$VERSION"
mvn deploy:deploy-file \
-Durl=https://devops.pravilanovait.hr/nexus/repository/maven-snapshots \
-Dpackaging=jar -DgroupId=$GROUP_ID -DartifactId=$ARTIFACT_ID \
-Dversion=$VERSION -DrepositoryId=local-nexus \
-Dfile=target/$ARTIFACT_ID-$VERSION.jar
# curl --request DELETE --user "admin:$NEXUS_ADMIN_PASSWORD" https://devops.pravilanovait.hr/nexus/service/rest/v1/repositories/maven/proxy/amazon-codeartifact/content/$GROUP_ID/$ARTIFACT_ID/$VERSION/$ARTIFACT_ID-$VERSION.jar
# curl --request POST --user "admin:$NEXUS_ADMIN_PASSWORD" https://devops.pravilanovait.hr/nexus/service/rest/v1/repositories/maven/proxy/amazon-codeartifact/invalidate-cache
env:
NEXUS_ADMIN_PASSWORD: ${{ secrets.NEXUS_ADMIN_PASSWORD }}