From f23d4b5698777688f9b863d05dcdb51400361256 Mon Sep 17 00:00:00 2001 From: RouxAntoine Date: Sat, 7 Sep 2024 09:39:33 +0200 Subject: [PATCH] feature: publish jar to the maven artifact registry on gitea --- .github/workflows/main.yaml | 36 ++++++++++++++++++++++++++--- .github/workflows/pull-request.yaml | 6 ++--- docs/README.md | 6 +++++ pom.xml | 13 +++++++++-- settings.xml | 17 ++++++++++++++ 5 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 settings.xml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c951dd7..97a165e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,13 +7,43 @@ on: jobs: build: + if: "contains(github.event.head_commit.message, vars.SKIP_CI_PREFIX) != true" + runs-on: runner - container: - image: catthehacker/ubuntu:act-latest steps: - uses: RouxAntoine/checkout@v3.5.4 + + - name: Retrieve root ca certificate + id: get-ca-cert + uses: RouxAntoine/get-ca-cert@v1.0.0 + - uses: actions/setup-java@v4 + id: java with: distribution: 'temurin' java-version: '21' - - run: ./mvnw verify jib:build + overwrite-settings: false + + - name: Add root certificate to java truststore + uses: RouxAntoine/add-ca-truststore@v1.1.0 + id: add-ca-to-truststore + with: + alias-name: antoine-roux.tk + ca-cert: "${{ steps.get-ca-cert.outputs.ca-cert }}" + store-path: "${{ steps.java.outputs.path }}/lib/security/cacerts" + + - name: Deploy container artifact + run: ./mvnw compile jib:build + + - name: Deploy maven jar artifact + run: ./mvnw deploy + env: + MAVEN_ARGS: "-s ${{ gitea.workspace }}/settings.xml" + TOKEN_REGISTRY: ${{ secrets.TOKEN_REGISTRY }} + + - uses: RouxAntoine/auto-changie@v1.0.1 + + - name: Push changelog + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "${{ vars.SKIP_CI_PREFIX }} Push updated changelog" diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 5d90bde..eab0645 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -6,12 +6,12 @@ on: jobs: build: runs-on: runner - container: - image: catthehacker/ubuntu:act-latest steps: - uses: RouxAntoine/checkout@v3.5.4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - - run: ./mvnw verify + + - run: ./mvnw verify deploy diff --git a/docs/README.md b/docs/README.md index 67b3ed8..a8a97f1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1 +1,7 @@ # Usage documentation + +to publish a docker image of this application use + +```shell +./mvnw compile jib:build +``` diff --git a/pom.xml b/pom.xml index 89246ea..29fc713 100644 --- a/pom.xml +++ b/pom.xml @@ -72,7 +72,7 @@ ${jib-maven-plugin.version} - container.localdomain:5000/${artifactId} + container.localdomain/${project.artifactId} eclipse-temurin:21.0.1_12-jdk @@ -126,7 +126,16 @@ maven-failsafe-plugin - + + + gitea + https://antoine-roux.tk/projects/api/packages/java-template/maven + + + gitea + https://antoine-roux.tk/projects/api/packages/java-template/maven + + diff --git a/settings.xml b/settings.xml new file mode 100644 index 0000000..6a94642 --- /dev/null +++ b/settings.xml @@ -0,0 +1,17 @@ + + + + gitea + + + + Authorization + token ${env.TOKEN_REGISTRY} + + + + + +