Skip to content

Commit

Permalink
Fix java version
Browse files Browse the repository at this point in the history
  • Loading branch information
carlesarnal committed Nov 20, 2024
1 parent a9cea6c commit 539adf3
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/create-github-release.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BRANCH="$2"
REPOSITORY="$3"
ACCESS_TOKEN="$4"

generate_post_data()
generate_post_data()
{
cat <<EOF
{
Expand All @@ -22,4 +22,4 @@ EOF

echo "Creating github release '$RELEASE_VERSION' for Repo '$REPOSITORY' and Branch: '$BRANCH'"
curl -H "Authorization: token $ACCESS_TOKEN" --data "$(generate_post_data)" "https://api.github.com/repos/$REPOSITORY/releases"
echo "Github Release Created Successfully"
echo "Github Release Created Successfully"
50 changes: 19 additions & 31 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,61 +18,53 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'Apicurio'
steps:
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Apicurio Registry Schema Validation Code Checkout
run: |
git init
git config --global user.name "apicurio-ci"
git config --global user.email "[email protected]"
git remote add origin "https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/$GITHUB_REPOSITORY.git"
git fetch
git checkout ${{ github.event.inputs.branch}}
git branch --set-upstream-to=origin/${{ github.event.inputs.branch}}
git pull
echo "#### Listing files after clone ####"
find .
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'

- name: Check Java Version
run: java -version


- name: Set up Maven
uses: stCarolas/setup-maven@v4
with:
maven-version: '3.6.3'


- name: Check Maven Version
run: mvn --version


- name: Log Metadata
run: |
echo "Releasing Apicurio Common Rest Client version ${{ github.event.inputs.release-version }} from branch ${{ github.event.inputs.branch }}"
echo "Releasing Apicurio Registry Schema Validation version ${{ github.event.inputs.release-version }} from branch ${{ github.event.inputs.branch }}"
echo "Next Snapshot version will be ${{ github.event.inputs.snapshot-version }}"
- name: Set up settings.xml
run: |
echo "<settings><servers><server><id>${{ secrets.OSSRH_ID }}</id><username>${{ secrets.OSSRH_USERNAME }}</username><password>${{ secrets.OSSRH_TOKEN }}</password></server></servers><profiles><profile><id>${{ secrets.OSSRH_ID }}</id><activation><activeByDefault>true</activeByDefault></activation><properties><gpg.executable>gpg</gpg.executable><gpg.passphrase>${{ secrets.GPG_PASSPHRASE}}</gpg.passphrase></properties></profile></profiles></settings>" > /home/runner/.m2/settings.xml
cat /home/runner/.m2/settings.xml
- name: Apicurio Common Client Code Checkout
run: |
git init
git config --global user.name "apicurio-ci"
git config --global user.email "[email protected]"
git remote add origin "https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/$GITHUB_REPOSITORY.git"
git fetch
git checkout ${{ github.event.inputs.branch}}
git branch --set-upstream-to=origin/${{ github.event.inputs.branch}}
git pull
echo "#### Listing files after clone ####"
find .
- name: Update Release Version ${{ github.event.inputs.release-version}}
run: mvn versions:set -DnewVersion=${{ github.event.inputs.release-version}} -DgenerateBackupPoms=false -DprocessAllModules=true


- name: Verify Build
run: mvn clean install


- name: Commit Release Version Change
run: |
git add .
Expand All @@ -85,11 +77,9 @@ jobs:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}


- name: Create GitHub Release
run: ./.github/scripts/create-github-release.sh ${{ github.event.inputs.release-version}} ${{ github.event.inputs.branch}} $GITHUB_REPOSITORY ${{ secrets.GITHUB_TOKEN }}


- name: Maven Deploy
run: |
# Retry 3 times before the steps actually fails
Expand All @@ -100,11 +90,9 @@ jobs:
(echo "===== Maven Deploy Attempt: 3 ====" && mvn deploy -Prelease --batch-mode --settings /home/runner/.m2/settings.xml -DskipTests) || \
(echo "==== Maven Deploy Step Failed ====" && exit 1)
- name: Update Snapshot version ${{ github.event.inputs.snapshot-version}}
run: mvn versions:set -DnewVersion=${{ github.event.inputs.snapshot-version}} -DgenerateBackupPoms=false -DprocessAllModules=true


- name: Commit Snapshot Version Change
run: |
git add .
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ on:
jobs:
build-verify:
name: Verify Build
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
if: github.repository_owner == 'Apicurio'
steps:
- uses: actions/setup-java@v2
- name: Checkout Code
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
java-version: 17
distribution: 'temurin'
cache: 'maven'

- name: Check Java Version
run: java -version
Expand All @@ -39,8 +44,5 @@ jobs:
- name: Check Maven Version
run: mvn --version

- name: Checkout Code
uses: actions/checkout@v2

- name: Build Project
run: mvn clean install
102 changes: 101 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@

<packaging>maven-plugin</packaging>

<url>https://www.apicur.io/</url>
<description>Apicurio Maven Plugin.</description>

<organization>
<name>Red Hat</name>
<url>https://www.redhat.com/</url>
</organization>

<licenses>
<license>
<name>Apache License Version 2.0</name>
<url>https://repository.jboss.org/licenses/apache-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/Apicurio/apicurio-maven-plugin/issues</url>
</issueManagement>

<scm>
<connection>scm:git:[email protected]:apicurio/apicurio-registry-schema-validation.git</connection>
<developerConnection>scm:git:[email protected]:apicurio/apicurio-registry-schema-validation.git</developerConnection>
<url>scm:git:[email protected]:apicurio/apicurio-registry-schema-validation.git</url>
</scm>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
Expand Down Expand Up @@ -62,7 +89,80 @@
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.8.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
<profiles>
<profile>
<id>release</id>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- Prevent `gpg` from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

0 comments on commit 539adf3

Please sign in to comment.