Skip to content
18 changes: 18 additions & 0 deletions .github/workflows/gh-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,21 @@ jobs:
working-directory: 'hello-strongbox-npm'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-hello-strongbox-maven:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
# generate GitHub Package Registry ci-friendly version to avoid collision
- run: echo "GPR_VERSION=$(date '+%Y%m%d.%H%M')" >> $GITHUB_ENV
- name: Maven install
run: mvn -Dgpr.version=$GPR_VERSION clean install
working-directory: 'hello-strongbox-maven'
# This is seperate so it may only be deployed conditionally
- name: Maven deploy
Comment on lines +85 to +86

This comment was marked as resolved.

Copy link
Member

@steve-todorov steve-todorov Oct 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually leave it as it is right now. It might be useful for branch deploys / testing.

run: mvn -Dgpr.version=$GPR_VERSION -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/$GITHUB_REPOSITORY deploy
working-directory: 'hello-strongbox-maven'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 22 additions & 1 deletion hello-strongbox-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@

<groupId>org.carlspring.strongbox.examples</groupId>
<artifactId>hello-strongbox-maven</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${gpr.version}</version>

<inceptionYear>2019</inceptionYear>

<properties>
<!-- GPR-friendly artifact version when deploying to GitHub Package Registry -->
<!-- The version string is generated via a GitHub action that deploys the artifact to the GitHub Package Registry -->
<!-- This is necessary as GitHub does not support overriding of published artifacts -->
<!-- See https://docs.github.com/en/free-pro-team@latest/packages/publishing-and-managing-packages/deleting-a-package#about-public-package-deletion -->
<gpr.version>1.0-SNAPSHOT</gpr.version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -43,4 +51,17 @@
</snapshotRepository>
</distributionManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>