Skip to content

Commit 3ed031e

Browse files
committed
Publish jar to GitHub Packages storage
1 parent 9fa1009 commit 3ed031e

2 files changed

Lines changed: 41 additions & 5 deletions

File tree

.github/workflows/maven.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,27 @@
66
# separate terms of service, privacy policy, and support
77
# documentation.
88

9-
name: Java CI with Maven
9+
name: Maven CI And Publish
1010

1111
on:
1212
push:
1313
branches: [ "main" ]
1414
pull_request:
1515
branches: [ "main" ]
16+
release:
17+
types: [ published ]
18+
workflow_dispatch:
1619

1720
jobs:
1821
build:
19-
2022
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
2125

2226
steps:
23-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2428
- name: Set up JDK 21
25-
uses: actions/setup-java@v3
29+
uses: actions/setup-java@v4
2630
with:
2731
java-version: '21'
2832
distribution: 'temurin'
@@ -33,3 +37,27 @@ jobs:
3337
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
3438
- name: Update dependency graph
3539
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
40+
41+
publish:
42+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
43+
needs: build
44+
runs-on: ubuntu-latest
45+
permissions:
46+
contents: read
47+
packages: write
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
- name: Set up JDK 21 for GitHub Packages
52+
uses: actions/setup-java@v4
53+
with:
54+
java-version: '21'
55+
distribution: 'temurin'
56+
cache: maven
57+
server-id: github
58+
server-username: GITHUB_ACTOR
59+
server-password: GITHUB_TOKEN
60+
- name: Publish to GitHub Packages
61+
run: mvn -B -DskipTests deploy --file pom.xml
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pom.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313

1414
<description>Utility classes for the Mutation Annotation Format (MAF) </description>
1515

16+
<distributionManagement>
17+
<repository>
18+
<id>github</id>
19+
<name>GitHub Packages</name>
20+
<url>https://maven.pkg.github.com/cBioPortal/maf</url>
21+
</repository>
22+
</distributionManagement>
23+
1624
<properties>
1725
<maven.compiler.source>21</maven.compiler.source>
1826
<maven.compiler.target>21</maven.compiler.target>
@@ -44,4 +52,4 @@
4452
<url>https://jitpack.io</url>
4553
</repository>
4654
</repositories>
47-
</project>
55+
</project>

0 commit comments

Comments
 (0)