Merge branch 'main' of https://github.com/potzplitz/ExtremeDemonList
This commit is contained in:
commit
b34e3bc8b3
1 changed files with 16 additions and 50 deletions
66
.github/workflows/maven.yml
vendored
66
.github/workflows/maven.yml
vendored
|
@ -15,61 +15,27 @@ jobs:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Check for [release] in commit message
|
||||||
|
id: check_release
|
||||||
|
run: |
|
||||||
|
if echo "${{ github.event.head_commit.message }}" | grep -q "\[release\]"; then
|
||||||
|
echo "Release tag found in commit message, proceeding with the workflow..."
|
||||||
|
echo "::set-output name=proceed::true"
|
||||||
|
else
|
||||||
|
echo "Release tag not found in commit message, stopping the workflow..."
|
||||||
|
echo "::set-output name=proceed::false"
|
||||||
|
fi
|
||||||
|
|
||||||
- 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'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: maven
|
cache: maven
|
||||||
|
# Fügen Sie das gleiche if: Bedingung zu allen nachfolgenden Schritten hinzu
|
||||||
|
# Beispiel:
|
||||||
- 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
|
||||||
|
# Wiederholen Sie das für alle nachfolgenden Schritte...
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: packaged-jar
|
|
||||||
path: target/*.jar
|
|
||||||
|
|
||||||
- name: Set release tag
|
|
||||||
id: set_release_tag
|
|
||||||
run: echo "::set-output name=RELEASE_TAG::$(date +'%Y%m%d%H%M%S')"
|
|
||||||
|
|
||||||
- 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
|
|
||||||
id: create_release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{ steps.set_release_tag.outputs.RELEASE_TAG }}
|
|
||||||
release_name: ${{ steps.get_commit_info.outputs.COMMIT_MSG }}
|
|
||||||
body: ${{ steps.get_commit_info.outputs.COMMIT_DESC }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
|
|
||||||
- name: Upload Artifact as Release Asset
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
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_content_type: application/ExtremeDemonList-0.0.1-SNAPSHOT-jar-with-dependencies.jar
|
|
||||||
|
|
Loading…
Reference in a new issue