From 05626f8f8fe52025b8b07129e12f337ce3869418 Mon Sep 17 00:00:00 2001 From: Mohamed Amgd <50220171+MohamedAmgd@users.noreply.github.com> Date: Tue, 14 Nov 2023 21:06:04 +0200 Subject: [PATCH 1/5] Create maven-publish.yml --- .github/workflows/maven-publish.yml | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/maven-publish.yml diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..fddf0a6 --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,46 @@ +# 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 Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: '' + java-version: '11' + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Publish to GitHub Packages Apache Maven + run: mvn deploy + env: + GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password + + - name: Set up Apache Maven Central + uses: actions/setup-java@v3 + with: # running setup-java again overwrites the settings.xml + distribution: 'temurin' + java-version: '11' + server-id: maven # Value of the distributionManagement/repository/id field of the pom.xml + server-username: MAVEN_USERNAME # env variable for username in deploy + server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import + gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase + + - name: Publish to Apache Maven Central + run: mvn deploy + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} From de298d74819d36aad02768e5b5a7c738e470d7d6 Mon Sep 17 00:00:00 2001 From: Mohamed Amgd <50220171+MohamedAmgd@users.noreply.github.com> Date: Tue, 14 Nov 2023 23:14:12 +0200 Subject: [PATCH 2/5] Update maven-publish.yml --- .github/workflows/maven-publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index fddf0a6..1b7f4b7 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -16,7 +16,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v3 with: - distribution: '' + distribution: 'temurin' java-version: '11' - name: Build with Maven @@ -35,7 +35,6 @@ jobs: server-id: maven # Value of the distributionManagement/repository/id field of the pom.xml server-username: MAVEN_USERNAME # env variable for username in deploy server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - name: Publish to Apache Maven Central From 3a548ab6561df8cf9b20a6f3dbbe48a33feb802b Mon Sep 17 00:00:00 2001 From: Mohamed Amgd <50220171+MohamedAmgd@users.noreply.github.com> Date: Tue, 14 Nov 2023 23:25:04 +0200 Subject: [PATCH 3/5] Update maven-publish.yml --- .github/workflows/maven-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 1b7f4b7..92cc9f5 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -32,7 +32,7 @@ jobs: with: # running setup-java again overwrites the settings.xml distribution: 'temurin' java-version: '11' - server-id: maven # Value of the distributionManagement/repository/id field of the pom.xml + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml server-username: MAVEN_USERNAME # env variable for username in deploy server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase From 6986051191a93239468f8a8844513ae0c754652f Mon Sep 17 00:00:00 2001 From: Mohamed Amgd <50220171+MohamedAmgd@users.noreply.github.com> Date: Tue, 14 Nov 2023 23:30:09 +0200 Subject: [PATCH 4/5] Update maven-publish.yml --- .github/workflows/maven-publish.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 92cc9f5..a1dfa9f 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -22,11 +22,6 @@ jobs: - name: Build with Maven run: mvn -B package --file pom.xml - - name: Publish to GitHub Packages Apache Maven - run: mvn deploy - env: - GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password - - name: Set up Apache Maven Central uses: actions/setup-java@v3 with: # running setup-java again overwrites the settings.xml From ec2aba2bafc90a12624c77e6ee9587659028e682 Mon Sep 17 00:00:00 2001 From: Mohamed Amgd <50220171+MohamedAmgd@users.noreply.github.com> Date: Wed, 15 Nov 2023 00:28:49 +0200 Subject: [PATCH 5/5] Update maven-publish.yml --- .github/workflows/maven-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index a1dfa9f..f2c8335 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -30,6 +30,7 @@ jobs: server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml server-username: MAVEN_USERNAME # env variable for username in deploy server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - name: Publish to Apache Maven Central