Skip to content

Commit

Permalink
configured to use sonatype snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
lausdahl committed Nov 20, 2023
1 parent 021329c commit d14e937
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 19 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ name: FMI to VDM
on: [workflow_dispatch, push, pull_request]
env:
JAVA_VERSION: 1.8
SERVER_ID: ossrh

jobs:
build:
Expand All @@ -24,25 +25,35 @@ jobs:
run: mvn clean package

deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/development'
if: github.ref == 'refs/heads/development'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure deploy for snapshots
if: github.ref == 'refs/heads/development'
run: echo "SERVER_ID=artifactory-into-cps-snapshots" >> $GITHUB_ENV

- id: install-secret-key
name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
# - name: Configure deploy for snapshots
# if: github.ref == 'refs/heads/development'
# run: echo "SERVER_ID=artifactory-into-cps-snapshots" >> $GITHUB_ENV
- name: Environment variables
run: echo ${{ env.SERVER_ID }}

- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ env.JAVA_VERSION }}
server-id: ${{ env.SERVER_ID }}
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Deploy
run: mvn -B -X deploy
run: mvn -B deploy -Psonatype
env:
MAVEN_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
132 changes: 120 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,45 @@
</configuration>
</plugin>


<!-- Attatch sources to all installed jars -->
<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</goal>
</goals>
</execution>
</executions>
<configuration>
<attach>true</attach>
</configuration>
</plugin>

<!-- Enable JavaDoc but dont fail on error. This must be disabled for
the Eclipse project in the IDE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnError>false</failOnError>
<quiet>true</quiet>
</configuration>
</plugin>

</plugins>
</pluginManagement>

Expand Down Expand Up @@ -150,18 +189,7 @@
</plugins>
</build>

<distributionManagement>
<repository>
<id>artifactory-into-cps-release</id>
<name>artifactory-into-cps-release</name>
<url>https://overture.au.dk/artifactory/into-cps</url>
</repository>
<snapshotRepository>
<id>artifactory-into-cps-snapshots</id>
<name>artifactory-into-cps-snapshots</name>
<url>https://overture.au.dk/artifactory/into-cps</url>
</snapshotRepository>
</distributionManagement>



<scm>
Expand Down Expand Up @@ -191,4 +219,84 @@

<inceptionYear>2020</inceptionYear>



<profiles>
<profile>
<id>sonatype</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.12</version>
<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>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>au</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<distributionManagement>
<repository>
<id>artifactory-into-cps-release</id>
<name>artifactory-into-cps-release</name>
<url>https://overture.au.dk/artifactory/into-cps</url>
</repository>
<snapshotRepository>
<id>artifactory-into-cps-snapshots</id>
<name>artifactory-into-cps-snapshots</name>
<url>https://overture.au.dk/artifactory/into-cps</url>
</snapshotRepository>
</distributionManagement>
</profile>

</profiles>

</project>

0 comments on commit d14e937

Please sign in to comment.