Skip to content

Commit f8a488f

Browse files
authored
Update maven-publish.yml
1 parent 7ab0b31 commit f8a488f

File tree

1 file changed

+49
-15
lines changed

1 file changed

+49
-15
lines changed
Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,68 @@
1-
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2-
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
1+
# # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2+
# # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
3+
4+
# name: Maven Package
5+
6+
# on: [push]
7+
8+
# jobs:
9+
# build:
10+
11+
# runs-on: macos-latest
12+
13+
# steps:
14+
# - uses: actions/checkout@v3
15+
# - name: Set up JDK 11
16+
# uses: actions/setup-java@v3
17+
# with:
18+
# java-version: '11'
19+
# distribution: 'corretto'
20+
21+
# - name: Build with Maven
22+
# run: mvn clean package
23+
24+
# # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
25+
# # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
326

427
name: Maven Package
528

6-
on:
7-
release:
8-
types: [created]
29+
on: [push]
30+
931

1032
jobs:
1133
build:
1234

1335
runs-on: ubuntu-latest
14-
permissions:
15-
contents: read
16-
packages: write
1736

1837
steps:
1938
- uses: actions/checkout@v3
2039
- name: Set up JDK 11
2140
uses: actions/setup-java@v3
2241
with:
2342
java-version: '11'
24-
distribution: 'temurin'
25-
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26-
settings-path: ${{ github.workspace }} # location for the settings.xml file
43+
distribution: 'corretto'
2744

2845
- name: Build with Maven
29-
run: mvn -B package --file pom.xml
46+
run: mvn clean package
47+
48+
- name: Create Release
49+
id: create_release
50+
uses: actions/create-release@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
tag_name: ${{ github.ref }}
55+
release_name: Release ${{ github.ref }}
56+
draft: false
57+
prerelease: false
3058

31-
- name: Publish to GitHub Packages Apache Maven
32-
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
59+
- name: Upload Release Asset
60+
id: upload-release-asset
61+
uses: actions/upload-release-asset@v1
3362
env:
34-
GITHUB_TOKEN: ${{ github.token }}
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
with:
65+
upload_url: ${{ github.event.release.upload_url }}
66+
asset_path: ./target/Automation-1.0-SNAPSHOT.jar # Replace with your JAR's path and name
67+
asset_name: Automation-1.0-SNAPSHOT.jar # Replace with your JAR's name
68+
asset_content_type: application/java-archive

0 commit comments

Comments
 (0)