Skip to content

Commit

Permalink
maven publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
stelzo committed Apr 1, 2024
1 parent da3bcae commit 0a0f164
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/generate-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,17 @@ jobs:
run: |
cd java-client
mkdir -p .github/workflows/
printf '%s\n' 'name: Go' 'on:' ' push:' ' branches: [ main ]' ' pull_request:' ' branches: [ main ]' 'jobs:' ' build:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v3' ' - name: Create Key File' ' run: echo "$GPG_PRIVATE_KEY" > private.key' ' env: ' ' GPG_PRIVATE_KEY: secrets.GPG_PRIVATE' ' - name: Import GPG Key' ' run: gpg --import --batch private.key' ' - name: Set up Java' ' uses: actions/setup-java@v4' ' with:' ' java-version: "17"' ' distribution: "temurin"' ' - name: Verify and test' ' run: mvn --batch-mode --update-snapshots verify && mvn test' > .github/workflows/build.yml
printf '%s\n' 'name: Upload Java Maven Package' 'on:' ' release:' ' types: [created]' 'permissions:' ' contents: read' ' packages: write' 'jobs:' ' deploy:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v4' ' - name: Set up Java' ' uses: actions/setup-java@v4' ' with:' ' java-version: "17"' ' distribution: "temurin"' ' server-id: central' ' server-username: MAVEN_USERNAME' ' server-password: MAVEN_PASSWORD' ' - name: Create Key File' ' run: echo "$GPG_PRIVATE_KEY" > private.key' ' env: ' ' GPG_PRIVATE_KEY: secrets.GPG_PRIVATE' ' - name: Import GPG Key' ' run: gpg --import --batch private.key' ' - name: Publish package' ' run: mvn --batch-mode deploy' ' env:' ' MAVEN_USERNAME: secrets.OSSRH_USERNAME' ' MAVEN_PASSWORD: secrets.OSSRH_TOKEN' ' GPG_KEYNAME: secrets.GPG_KEYNAME' > .github/workflows/publish.yml
printf '%s\n' 'name: Upload Java Maven Package' 'on:' ' release:' ' types: [created]' 'permissions:' ' contents: read' ' packages: write' 'jobs:' ' deploy:' ' runs-on: ubuntu-latest' ' steps:' ' - uses: actions/checkout@v4' ' - name: Set up Java' ' uses: actions/setup-java@v4' ' with:' ' java-version: "17"' ' distribution: "temurin"' ' - name: Release Maven package' ' uses: samuelmeuli/action-maven-publish@v1.4.0' ' with:' ' maven_profiles: deploy, verify' ' gpg_private_key: secrets.GPG_PRIVATE' ' gpg_passphrase: ""' ' nexus_username: secrets.OSSRH_USERNAME' ' nexus_password: secrets.OSSRH_TOKEN' > .github/workflows/publish.yml
sed -i 's/secrets.OSSRH_TOKEN/\$\{\{secrets.OSSRH_TOKEN\}\}/g' .github/workflows/publish.yml
sed -i 's/secrets.OSSRH_USERNAME/\$\{\{secrets.OSSRH_USERNAME\}\}/g' .github/workflows/publish.yml
sed -i 's/secrets.GPG_KEYNAME/\$\{\{secrets.GPG_KEYNAME\}\}/g' .github/workflows/build.yml
sed -i 's/secrets.GPG_PRIVATE/\$\{\{secrets.GPG_PRIVATE\}\}/g' .github/workflows/build.yml
sed -i 's/secrets.GPG_KEYNAME/\$\{\{secrets.GPG_KEYNAME\}\}/g' .github/workflows/publish.yml
sed -i 's/secrets.GPG_PRIVATE/\$\{\{secrets.GPG_PRIVATE\}\}/g' .github/workflows/publish.yml
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV
sed -i 's|</description>|</description><url>https://github.com/dofusdude/dofusdude-java</url>|g' pom.xml
sed -i 's|<build>|<scm><connection>scm:git:git@github.com:dofusdude/dofusdude-java.git</connection><developerConnection>scm:git:git@github.com:dofusdude/dofusdude-java.git</developerConnection><url>https://github.com/dofusdude/dofusdude-java/tree/main</url></scm><licenses><license><name>GNU General Public License 3</name><url>https://www.gnu.org/licenses/gpl-3.0.txt</url><distribution>repo</distribution></license></licenses><developers><developer><id>stelzo</id><name>Christopher Sieh</name><url>https://github.com/stelzo</url><roles><role>developer</role></roles></developer></developers><build>|g' pom.xml
sed -i 's|</plugins>|<plugin><groupId>org.sonatype.central</groupId><artifactId>central-publishing-maven-plugin</artifactId><version>0.4.0</version><extensions>true</extensions><configuration><publishingServerId>central</publishingServerId><autoPublish>true</autoPublish><tokenAuth>true</tokenAuth></configuration></plugin></plugins>|g' pom.xml
sed -i 's|</plugins>|<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-javadoc-plugin</artifactId><version>3.6.3</version><executions><execution><id>attach-javadocs</id><goals><goal>jar</goal></goals></execution></executions></plugin></plugins>|g' pom.xml
sed -i 's|</plugins>|<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><version>3.3.0</version><executions><execution><id>attach-sources</id><goals><goal>jar</goal></goals></execution></executions></plugin></plugins>|g' pom.xml
sed -i 's|</plugins>|<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-gpg-plugin</artifactId><version>3.2.2</version><executions><execution><id>sign-artifacts</id><phase>verify</phase><goals><goal>sign</goal></goals><configuration><gpgArguments><arg>--batch</arg><arg>--yes</arg></gpgArguments></configuration></execution></executions></plugin></plugins>|g' pom.xml
sed -i 's|</plugins>|<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-gpg-plugin</artifactId><version>3.2.2</version><executions><execution><id>sign-artifacts</id><phase>verify</phase><goals><goal>sign</goal></goals><configuration><gpgArguments><arg>--pinentry-mode</arg><arg>loopback</arg></gpgArguments></configuration></execution></executions></plugin></plugins>|g' pom.xml
sed -i 's|</dependencies>| <dependency><groupId>org.openapitools</groupId><artifactId>jackson-databind-nullable</artifactId><version>0.2.6</version></dependency></dependencies>|g' pom.xml
sed -i 's|</project>| <distributionManagement><repository><id>central</id><name>Central Repository Central</name><url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url></repository></distributionManagement></project>|g' pom.xml
sed -i 's/\\"/"/g' README.md
Expand Down

0 comments on commit 0a0f164

Please sign in to comment.