genau
This commit is contained in:
parent
d374a3bd50
commit
074ae1e346
1 changed files with 26 additions and 18 deletions
44
.github/workflows/maven.yml
vendored
44
.github/workflows/maven.yml
vendored
|
@ -1,18 +1,19 @@
|
||||||
name: Java Maven Build & Publish Artifact
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main, feature/*] # Specify the branches to trigger on
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
if: steps.check_release.outputs.proceed == 'true'
|
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
|
@ -20,41 +21,48 @@ jobs:
|
||||||
cache: maven
|
cache: maven
|
||||||
|
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
if: steps.check_release.outputs.proceed == 'true'
|
|
||||||
run: mvn -B package --file pom.xml
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
# Ensure all subsequent steps that depend on the build/release process also include the conditional check
|
|
||||||
# Example for the Upload artifact step; repeat for others as necessary
|
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
if: steps.check_release.outputs.proceed == 'true'
|
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: packaged-jar
|
name: packaged-jar
|
||||||
path: target/*.jar
|
path: target/*.jar
|
||||||
|
|
||||||
# Correct and continue your steps with the appropriate conditional checks and proper configurations
|
|
||||||
|
|
||||||
- name: Set release tag
|
- name: Set release tag
|
||||||
if: steps.check_release.outputs.proceed == 'true'
|
id: set_release_tag
|
||||||
run: echo "::set-output name=RELEASE_TAG::$(date +'%Y%m%d%H%M%S')"
|
run: echo "::set-output name=RELEASE_TAG::$(date +'%Y%m%d%H%M%S')"
|
||||||
|
|
||||||
# Add the conditional checks to all steps that should only run if the release tag is present
|
- name: Create extracted-jar directory
|
||||||
|
run: mkdir extracted-jar
|
||||||
|
|
||||||
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: packaged-jar
|
||||||
|
path: extracted-jar
|
||||||
|
|
||||||
|
- name: Get commit message and description
|
||||||
|
id: get_commit_info
|
||||||
|
run: |
|
||||||
|
COMMIT_MSG=$(git log --format=%B -n 1 ${{ github.sha }})
|
||||||
|
COMMIT_DESC=$(git show -s --format=%b ${{ github.sha }})
|
||||||
|
echo "::set-output name=COMMIT_MSG::$COMMIT_MSG"
|
||||||
|
echo "::set-output name=COMMIT_DESC::$COMMIT_DESC"
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
if: steps.check_release.outputs.proceed == 'true'
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.set_release_tag.outputs.RELEASE_TAG }}
|
tag_name: ${{ steps.set_release_tag.outputs.RELEASE_TAG }}
|
||||||
release_name: ExtremeDemonList v${{ steps.set_release_tag.outputs.RELEASE_TAG }}
|
release_name: ExtremeDemonList v${{ RELEASE_TAG }}
|
||||||
body: ${{ steps.get_commit_info.outputs.COMMIT_DESC }}
|
body: ${{ steps.get_commit_info.outputs.COMMIT_DESC }}
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
||||||
- name: Upload Artifact as Release Asset
|
- name: Upload Artifact as Release Asset
|
||||||
if: steps.check_release.outputs.proceed == 'true'
|
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -62,4 +70,4 @@ jobs:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: extracted-jar/ExtremeDemonList-0.0.1-SNAPSHOT-jar-with-dependencies.jar
|
asset_path: extracted-jar/ExtremeDemonList-0.0.1-SNAPSHOT-jar-with-dependencies.jar
|
||||||
asset_name: ExtremeDemonList-0.0.1-SNAPSHOT-jar-with-dependencies.jar
|
asset_name: ExtremeDemonList-0.0.1-SNAPSHOT-jar-with-dependencies.jar
|
||||||
asset_content_type: application/java-archive # Corrected content type for a JAR file
|
asset_content_type: application/ExtremeDemonList-0.0.1-SNAPSHOT-jar-with-dependencies.jar
|
Loading…
Reference in a new issue