Skip to content

Commit

Permalink
Deploy snapshot to github packages
Browse files Browse the repository at this point in the history
  • Loading branch information
spannm committed Feb 24, 2024
1 parent 36337da commit ba180a2
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 6 deletions.
50 changes: 45 additions & 5 deletions .github/workflows/ci_jdk11_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
branches:
- master
pull_request:

branches:
- master
workflow_dispatch:
branches:
- master

Expand All @@ -15,7 +17,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: temurin
cache: maven

- name: Build with Maven/JDK 11
run: mvn --batch-mode --file pom.xml clean package

deploy_sonatype:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup
uses: actions/setup-java@v3
with:
java-version: '11'
Expand All @@ -25,8 +44,29 @@ jobs:
server-id: sonatype-nexus-snapshots
server-username: SONATYPE_OSSRH_USERNAME
server-password: SONATYPE_OSSRH_PASSWORD
- name: Build with Maven/JDK 11
run: mvn --batch-mode --file pom.xml clean deploy

- name: Deploy snapshot to Sonatype
run: mvn --batch-mode --file pom.xml --activate-profiles fast deploy
env:
SONATYPE_OSSRH_USERNAME: ${{ secrets.SONATYPE_OSSRH_USERNAME }}
SONATYPE_OSSRH_PASSWORD: ${{ secrets.SONATYPE_OSSRH_PASSWORD }}

deploy_github:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: temurin
cache: maven
server-username: spannm
server-password: GITHUB_TOKEN

- name: Deploy snapshot to Github packages
run: mvn -X --batch-mode --file pom.xml --activate-profiles fast,github-deploy-snapshot-package deploy
env:
SONATYPE_OSSRH_USERNAME: ${{ secrets.SONATYPE_OSSRH_USERNAME }}
SONATYPE_OSSRH_PASSWORD: ${{ secrets.SONATYPE_OSSRH_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci_jdk11_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
distribution: temurin
cache: maven
- name: Build with Maven/JDK 11 on Windows
run: mvn --batch-mode clean verify --file pom.xml
run: mvn --batch-mode --file pom.xml clean verify
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
</repository>
<site>
<id>local</id>
<name>Local Maven site</name>
<url>file://${java.io.tmpdir}/${project.artifactId}/site-prepared</url>
</site>
</distributionManagement>
Expand Down Expand Up @@ -286,6 +287,17 @@
</properties>
</profile>

<profile>
<id>github-deploy-snapshot-package</id>
<distributionManagement>
<snapshotRepository>
<id>github-${project.artifactId}</id>
<name>${developerId} github packages</name>
<url>https://maven.pkg.github.com/${developerId}/${project.artifactId}</url>
</snapshotRepository>
</distributionManagement>
</profile>

<profile>
<id>release</id>
<activation>
Expand Down

0 comments on commit ba180a2

Please sign in to comment.