Skip to content

Commit 4d59c29

Browse files
authored
Merge pull request #6 from cicirello/development
Workflow update
2 parents 7af251d + ff757f3 commit 4d59c29

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

.github/workflows/maven-publish.yml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212

1313
runs-on: ubuntu-latest
1414

15+
env:
16+
artifact_name: jpt
17+
1518
steps:
1619
- uses: actions/checkout@v2
1720
- name: Set up JDK 1.8
@@ -21,15 +24,58 @@ jobs:
2124
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
2225
settings-path: ${{ github.workspace }} # location for the settings.xml file
2326

27+
- name: Get the release version
28+
id: get_version
29+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
30+
2431
- name: Build with Maven
2532
run: mvn -B package --file pom.xml -s ${{ github.workspace }}/settings.xml
2633
env:
2734
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2835

29-
- name: Update version
30-
run: mvn versions:set -DnewVersion=${GITHUB_REF:11}
36+
- name: Update package version
37+
run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
3138

3239
- name: Publish to GitHub Packages Apache Maven
3340
run: mvn deploy -s ${{ github.workspace }}/settings.xml
3441
env:
3542
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Get the upload URL for a release
45+
id: get
46+
uses: bruceadams/[email protected]
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Upload Release Asset jar
51+
id: upload-release-asset-jar
52+
uses: actions/[email protected]
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
with:
56+
upload_url: ${{ steps.get.outputs.upload_url }}
57+
asset_path: dist/${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}.jar
58+
asset_name: ${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}.jar
59+
asset_content_type: application/java-archive
60+
61+
- name: Upload Release Asset sources
62+
id: upload-release-asset-src
63+
uses: actions/[email protected]
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
with:
67+
upload_url: ${{ steps.get.outputs.upload_url }}
68+
asset_path: dist/${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}-sources.jar
69+
asset_name: ${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}-sources.jar
70+
asset_content_type: application/java-archive
71+
72+
- name: Upload Release Asset docs
73+
id: upload-release-asset-docs
74+
uses: actions/[email protected]
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
upload_url: ${{ steps.get.outputs.upload_url }}
79+
asset_path: dist/${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}-javadoc.jar
80+
asset_name: ${{ env.artifact_name }}-${{ steps.get_version.outputs.VERSION }}-javadoc.jar
81+
asset_content_type: application/java-archive

.m2/settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<repository>
1515
<id>github</id>
1616
<name>GitHub cicirello Apache Maven Packages</name>
17-
<url>https://maven.pkg.github.com/cicirello</url>
17+
<url>https://maven.pkg.github.com/</url>
1818
</repository>
1919
</repositories>
2020
</profile>

0 commit comments

Comments
 (0)