|
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 |
3 | 26 |
|
4 | 27 | name: Maven Package |
5 | 28 |
|
6 | | -on: |
7 | | - release: |
8 | | - types: [created] |
| 29 | +on: [push] |
| 30 | + |
9 | 31 |
|
10 | 32 | jobs: |
11 | 33 | build: |
12 | 34 |
|
13 | 35 | runs-on: ubuntu-latest |
14 | | - permissions: |
15 | | - contents: read |
16 | | - packages: write |
17 | 36 |
|
18 | 37 | steps: |
19 | 38 | - uses: actions/checkout@v3 |
20 | 39 | - name: Set up JDK 11 |
21 | 40 | uses: actions/setup-java@v3 |
22 | 41 | with: |
23 | 42 | 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' |
27 | 44 |
|
28 | 45 | - 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 |
30 | 58 |
|
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 |
33 | 62 | 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