3232 java-version : ' 17'
3333 distribution : ' temurin'
3434 server-id : central
35+ cache : maven
36+ overwrite-settings : false
3537 server-username : ${{ secrets.MAVEN_CENTRAL_USERNAME }}
3638 server-password : ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
3739 gpg-private-key : ${{ secrets.OSSRH_GPG_PRIVATE_KEY }}
40+ - name : Add Central-Portal snapshot repo to settings.xml
41+ 42+ with :
43+ repositories : ' [{"id":"central-portal-snapshots","name":"Sonatype Central Portal snapshots","url":"https://central.sonatype.com/repository/maven-snapshots/","releases":{"enabled":false},"snapshots":{"enabled":true}}]'
44+ servers : ' [{"id":"central","username":"${{ secrets.MAVEN_CENTRAL_USERNAME }}","password":"${{ secrets.MAVEN_CENTRAL_PASSWORD }}"}]'
3845 - name : Cache Maven repository
3946 uses : actions/cache@v4
4047 with :
@@ -60,20 +67,28 @@ jobs:
6067 fi
6168 echo "SC_VERSION=$MY_POM_VERSION" >> $GITHUB_ENV
6269 - name : Check Release Version codegen-generators
63- id : preRelease generators
70+ id : preReleaseGenerators
6471 if : env.RELEASE_OK == 'yes'
6572 working-directory : generators-repo
6673 run : |
6774 # export GPG_TTY=$(tty)
68- export MY_POM_VERSION_GENERATORS=`mvn -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
75+ SNAP_API="https://central.sonatype.com/repository/maven-snapshots"
76+ ARTIFACT_PATH="io/swagger/codegen/v3/swagger-codegen"
77+ ROOT_META="${SNAP_API}/${ARTIFACT_PATH}/maven-metadata.xml"
78+ export LAST_SNAP=$(curl -s "$ROOT_META" | grep -oP '(?<=<version>)3\.[^<]+' | sort -V | tail -n1)
79+ echo "LAST_SNAP $LAST_SNAP"
80+ export CODEGEN_VERSION_PROPERTY=-Dswagger-codegen-version=$LAST_SNAP
81+ export MY_POM_VERSION_GENERATORS=`mvn -q -Dexec.executable="echo" ${CODEGEN_VERSION_PROPERTY} -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`
82+ echo "generator version: " ${MY_POM_VERSION_GENERATORS}
6983 if [[ $MY_POM_VERSION_GENERATORS =~ ^.*SNAPSHOT$ ]];
7084 then
7185 echo "not releasing snapshot version: " ${MY_POM_VERSION_GENERATORS}
7286 echo "RELEASE_OK=no" >> $GITHUB_ENV
7387 else
7488 echo "RELEASE_OK=yes" >> $GITHUB_ENV
7589 fi
76- echo "SC_VERSION_GENERATORS=$MY_POM_VERSION_GENERATORS" >> $GITHUB_ENV
90+ echo "generator version: " ${$MY_POM_VERSION_GENERATORS}
91+ echo "SC_VERSION_GENERATORS=${MY_POM_VERSION_GENERATORS}" >> $GITHUB_ENV
7792 - name : Run maven install for codegen-generators
7893 if : env.RELEASE_OK == 'yes'
7994 working-directory : generators-repo
0 commit comments