Merge branch 'main' of https://github.com/potzplitz/ExtremeDemonList
This commit is contained in:
commit
f5cedb3251
1 changed files with 26 additions and 45 deletions
69
.github/workflows/maven.yml
vendored
69
.github/workflows/maven.yml
vendored
|
@ -1,65 +1,46 @@
|
||||||
name: Build und Veröffentlichen des Java-Projekts
|
name: Java Build and File Update
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout des Codes
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setze JDK 17 ein
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
distribution: 'temurin'
|
distribution: 'adopt'
|
||||||
|
server-id: 'github'
|
||||||
|
server-username: ${{ github.actor }}
|
||||||
|
server-password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Konfiguriere Git-Benutzer
|
- name: Build Java project with Maven
|
||||||
|
run: mvn clean package
|
||||||
|
|
||||||
|
- name: Check if JAR files exist
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "action@github.com"
|
if [ ! -d "target" ] || [ -z "$(ls -A target/*.jar)" ]; then
|
||||||
git config --local user.name "GitHub Action"
|
echo "No JAR files found in target directory or target directory does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Bestimme Versionsnummer
|
- name: Create builds directory
|
||||||
id: version
|
run: mkdir -p builds
|
||||||
run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Erstelle Git-Tag
|
- name: Copy built JAR files
|
||||||
run: git tag v${{ steps.version.outputs.VERSION }} -a -m "Generierter Tag von GitHub Actions"
|
run: cp -r target/*.jar builds/
|
||||||
|
|
||||||
- name: Sende Tags
|
- name: Update version.txt
|
||||||
run: git push --tags --quiet
|
run: |
|
||||||
|
sed -i 's/old_text/new_text/g' ver/version.txt
|
||||||
- name: Baue mit Maven
|
git add ver/version.txt builds/*.jar
|
||||||
run: mvn clean install
|
git commit -m "Updated version and built JAR files"
|
||||||
|
git push
|
||||||
- name: Erstelle Release
|
|
||||||
id: create_release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: v${{ steps.version.outputs.VERSION }}
|
|
||||||
release_name: Release v${{ steps.version.outputs.VERSION }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
|
|
||||||
- name: Lade Artefakt zur Veröffentlichung hoch
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ./builds/ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar
|
|
||||||
asset_name: ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar
|
|
||||||
asset_content_type: application/java-archive
|
|
||||||
|
|
Loading…
Reference in a new issue