Skip to content

Commit

Permalink
Merge pull request #27 from castor-software/issue_26
Browse files Browse the repository at this point in the history
Deploy to Maven Central v0.0.1
  • Loading branch information
cesarsotovalero authored Dec 16, 2022
2 parents f568995 + a94653c commit 0c1b0db
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy
on:
workflow_dispatch:
inputs:
versionName:
description: 'Version Name'
required: true
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Install Java and Maven
uses: actions/setup-java@v2
with:
distribution: 'adopt-hotspot'
java-version: 17
server-id: ossrh
server-username: OSSRH_USERNAME # env variable for username in deploy
server-password: OSSRH_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Release Maven package
run: mvn deploy -P deploy -Djacoco.skip=true
env:
OSSRH_USERNAME: ${{ secrets.NEXUS_USERNAME }}
OSSRH_TOKEN: ${{ secrets.NEXUS_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Create and push tag
run: |
git config --global user.email "[email protected]"
git config --global user.name "$GITHUB_ACTOR"
git tag -a $TAG -m "Release v$TAG"
git push origin $TAG
env:
TAG: ${{ github.event.inputs.versionName }}

- name: Create Release on GitHub
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.versionName }}
release_name: MyLib ${{ github.event.inputs.versionName }}
draft: true
prerelease: false
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# DepTrim <img src=".img/logo.svg" align="left" height="135px" alt="DepTrim logo"/>

[![Maven Central](https://img.shields.io/maven-central/v/se.kth.castor/deptrim-maven-plugin.svg)](https://search.maven.org/search?q=g:se.kth.castor%20AND%20a:deptrim*)
[![build](https://github.com/castor-software/deptrim/actions/workflows/build.yml/badge.svg)](https://github.com/castor-software/deptrim/actions/workflows/build.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=castor-software_deptrim&metric=alert_status)](https://sonarcloud.io/dashboard?id=castor-software_deptrim)
[![codecov](https://codecov.io/gh/castor-software/deptrim/branch/main/graph/badge.svg?token=L70YMFGJ4D)](https://codecov.io/gh/castor-software/deptrim)
Expand Down
105 changes: 104 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<!-- Project description-->
<name>DepTrim</name>
<description>DepTrim automatically diversifies dependencies in Maven projects through software debloating.</description>
<description>DepTrim automatically specializes the software supply chain of dependencies in Maven projects.</description>
<url>https://github.com/castor-software/deptrim</url>

<!-- Issues are managed on GitHub -->
Expand Down Expand Up @@ -187,6 +187,17 @@
</dependency>
</dependencies>

<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 options -->
<build>
<!-- Integration tests -->
Expand Down Expand Up @@ -384,4 +395,96 @@
</plugins>
</reporting>

<profiles>
<!-- To deploy via command line use: `mvn deploy -P deploy` -->
<profile>
<id>deploy</id>
<build>
<plugins>
<!-- Maven compiler plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<!-- Maven source plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Javadoc plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<source>${javadoc.source}</source>
<doclint>none</doclint>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Maven GPG plugin to sign the components -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Nexus Staging Maven plugin for deployment to Sonatype-->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.9</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<!-- Performing a release deployment with the Maven Release Plugin -->
<!-- see https://central.sonatype.org/pages/apache-maven.html -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

0 comments on commit 0c1b0db

Please sign in to comment.