Prepare for deployment on ossrh

This commit is contained in:
Cédric Couralet 2021-05-01 19:32:15 +02:00
parent a849fb9ab6
commit a87fce8bb5
3 changed files with 149 additions and 6 deletions

33
.github/workflows/deploy-maven.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Publish package to the Maven Central Repository
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Maven Central Repository
uses: actions/setup-java@v1
with:
java-version: 11
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- id: install-secret-key
name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- id: publish-to-central
name: Publish to Central Repository
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: |
mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }}
mvn \
--no-transfer-progress \
--batch-mode \
-Dgpg.passphrase=${{ secrets.OSSRH_GPG_KEY_PASSWORD }} \
clean deploy

View File

@ -25,7 +25,7 @@ jobs:
restore-keys: ${{ runner.os }}-m2
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
mvn -B versions:set -DnewVersion=${{ github.ref }}
mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }}
mvn -B package
- name: Create Release
id: create_release
@ -33,8 +33,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
tag_name: ${{ github.event.release.tag_name }}
release_name: Release ${{ github.event.release.tag_name }}
draft: false
prerelease: false
- name: Upload Release Asset
@ -44,6 +44,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: target/keycloak-mail-whitelisting-${{ github.ref }}.jar
asset_name: keycloak-mail-whitelisting-${{ github.ref }}.jar
asset_path: target/keycloak-mail-whitelisting-${{ github.event.release.tag_name }}.jar
asset_name: keycloak-mail-whitelisting-${{ github.event.release.tag_name }}.jar
asset_content_type: application/jar

111
pom.xml
View File

@ -2,13 +2,39 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.micedre.keycloak</groupId>
<artifactId>keycloak-mail-whitelisting</artifactId>
<version>1.2-SNAPSHOT</version>
<version>1.3-SNAPSHOT</version>
<name>Keycloak mail whitelisting extension</name>
<description>A keycloak extension to block non authorized domain to register</description>
<url>http://github.com/micedre/keycloak-mail-whitelisting</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>Cédric Couralet</name>
<email>cedric.couralet@gmail.com</email>
<url>https://github.com/micedre</url>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/micedre/keycloak-mail-whitelisting.git</connection>
<developerConnection>scm:git:ssh://github.com:micedre/keycloak-mail-whitelisting.git</developerConnection>
<url>https://github.com/micedre/keycloak-mail-whitelisting/tree/master</url>
<tag>keycloak-mail-whitelisting-1.2</tag>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<keycloak.version>9.0.3</keycloak.version>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak</groupId>
@ -45,6 +71,89 @@
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.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.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<!-- <gpg.passphrase>${env.GPG_PASSWORD}</gpg.passphrase> -->
</properties>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<!-- Change to true once we're good! -->
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>