From dd0a2a7b439942dddebc3bb6129787f60b0fa8c4 Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:10:50 +0100 Subject: [PATCH 01/11] Update maven.yml --- .github/workflows/maven.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2d34b62..aa28b54 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -42,6 +42,7 @@ jobs: - name: Baue mit Maven run: mvn clean install + working-directory: ./builds # Set the working directory to the "builds" directory - name: Erstelle Release id: create_release From 7cf994093384a58c84c19a8728b2b63235c11c9a Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:12:38 +0100 Subject: [PATCH 02/11] Update maven.yml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index aa28b54..96f6bfb 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -42,7 +42,7 @@ jobs: - name: Baue mit Maven run: mvn clean install - working-directory: ./builds # Set the working directory to the "builds" directory + working-directory: ./ # Set the working directory to the root of the project - name: Erstelle Release id: create_release From 1a269bfa836bf1dcff9de75af8cd8a98097b99d2 Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:17:02 +0100 Subject: [PATCH 03/11] Update maven.yml --- .github/workflows/maven.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 96f6bfb..1eadafc 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -44,16 +44,8 @@ jobs: run: mvn clean install working-directory: ./ # Set the working directory to the root of the project - - 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: List contents of builds directory + run: ls -l ./builds - name: Lade Artefakt zur Veröffentlichung hoch uses: actions/upload-release-asset@v1 @@ -61,6 +53,6 @@ jobs: 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_path: ./target/ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar # Update the path to the generated JAR file asset_name: ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar asset_content_type: application/java-archive From 1af63e99880b73a729a7d894619d9366cbaf8c0f Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:19:00 +0100 Subject: [PATCH 04/11] Update maven.yml --- .github/workflows/maven.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 1eadafc..25661da 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -44,15 +44,12 @@ jobs: run: mvn clean install working-directory: ./ # Set the working directory to the root of the project - - name: List contents of builds directory - run: ls -l ./builds - - name: Lade Artefakt zur Veröffentlichung hoch uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }} # Provide the upload URL obtained from create-release action with: - upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./target/ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar # Update the path to the generated JAR file asset_name: ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar asset_content_type: application/java-archive From c57f233cc619a254f94b3a8c95f31ca7a1438992 Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:22:28 +0100 Subject: [PATCH 05/11] Update maven.yml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 25661da..cc1c144 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -48,7 +48,7 @@ jobs: uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - UPLOAD_URL: ${{ steps.create_release.outputs.upload_url }} # Provide the upload URL obtained from create-release action + UPLOAD_URL: ${{ secrets.UPLOAD_URL }} # Use the appropriate secret or variable containing the upload URL with: asset_path: ./target/ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar # Update the path to the generated JAR file asset_name: ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar From 63de173d611b9245eae0f81e9369712488a8aaf1 Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:24:56 +0100 Subject: [PATCH 06/11] Update maven.yml --- .github/workflows/maven.yml | 61 +++++++++++++------------------------ 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index cc1c144..db44a33 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,55 +1,36 @@ -name: Build und Veröffentlichen des Java-Projekts +name: Java Build and File Update on: push: branches: - - main - pull_request: - branches: - - main - -permissions: - contents: write + - main # Anpassen, falls du andere Branches verwenden möchtest jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout des Codes + - name: Checkout code uses: actions/checkout@v2 - - - name: Setze JDK 17 ein + + - name: Set up JDK uses: actions/setup-java@v2 with: - java-version: '17' - distribution: 'temurin' - - - name: Konfiguriere Git-Benutzer + java-version: '11' # Anpassen, falls eine andere JDK-Version verwendet werden soll + + - name: Build Java project run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" + ./gradlew build # Anpassen, falls du ein anderes Build-Tool verwendest + + - name: Create builds directory + run: mkdir -p builds + + - name: Copy built JAR file + run: cp -r /*.jar builds/ # Anpassen, je nachdem, wo deine gebauten Dateien sind - - name: Bestimme Versionsnummer - id: version - run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - - name: Erstelle Git-Tag - run: git tag v${{ steps.version.outputs.VERSION }} -a -m "Generierter Tag von GitHub Actions" - - - name: Sende Tags - run: git push --tags --quiet - - - name: Baue mit Maven - run: mvn clean install - working-directory: ./ # Set the working directory to the root of the project - - - name: Lade Artefakt zur Veröffentlichung hoch - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - UPLOAD_URL: ${{ secrets.UPLOAD_URL }} # Use the appropriate secret or variable containing the upload URL - with: - asset_path: ./target/ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar # Update the path to the generated JAR file - asset_name: ExtremeDemonList-${{ steps.version.outputs.VERSION }}-SNAPSHOT.jar - asset_content_type: application/java-archive + - name: Update version.txt + run: | + sed -i 's/old_text/new_text/g' ver/version.txt # Anpassen der alten und neuen Texte + git add ver/version.txt builds/*.jar + git commit -m "Updated version and built JAR file" + git push From 163b8f74205e7c42300ee2282e22b92b98d02394 Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:25:34 +0100 Subject: [PATCH 07/11] Update maven.yml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index db44a33..2b8e89d 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -16,7 +16,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v2 with: - java-version: '11' # Anpassen, falls eine andere JDK-Version verwendet werden soll + java-version: '17' # Anpassen, falls eine andere JDK-Version verwendet werden soll - name: Build Java project run: | From 4779315d107b614ac9af0fc94836585387971e6b Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:26:35 +0100 Subject: [PATCH 08/11] Update maven.yml --- .github/workflows/maven.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2b8e89d..3fbdf8f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -16,7 +16,12 @@ jobs: - name: Set up JDK uses: actions/setup-java@v2 with: - java-version: '17' # Anpassen, falls eine andere JDK-Version verwendet werden soll + java-version: '17' # Anpassen auf die gewünschte Java-Version + distribution: 'adopt' + server-id: 'github' + server-username: ${{ github.actor }} + server-password: ${{ secrets.GITHUB_TOKEN }} + - name: Build Java project run: | From 6573ac021cebfa4d9c5d2231569036c68de572bd Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:27:42 +0100 Subject: [PATCH 09/11] Update maven.yml --- .github/workflows/maven.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 3fbdf8f..ee0908c 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -16,22 +16,16 @@ jobs: - name: Set up JDK uses: actions/setup-java@v2 with: - java-version: '17' # Anpassen auf die gewünschte Java-Version - distribution: 'adopt' - server-id: 'github' - server-username: ${{ github.actor }} - server-password: ${{ secrets.GITHUB_TOKEN }} - + java-version: '17' # Anpassen, falls eine andere JDK-Version verwendet werden soll - - name: Build Java project - run: | - ./gradlew build # Anpassen, falls du ein anderes Build-Tool verwendest + - name: Build Java project with Maven + run: mvn clean package # Anpassen, falls weitere Maven-Optionen benötigt werden - name: Create builds directory run: mkdir -p builds - name: Copy built JAR file - run: cp -r /*.jar builds/ # Anpassen, je nachdem, wo deine gebauten Dateien sind + run: cp -r target/*.jar builds/ # Anpassen, je nachdem, wo deine gebauten Dateien sind - name: Update version.txt run: | From 76fc98dc0b6627acde006da09396b27b552cc8fd Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:28:17 +0100 Subject: [PATCH 10/11] Update maven.yml --- .github/workflows/maven.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index ee0908c..fe5abc9 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -3,7 +3,7 @@ name: Java Build and File Update on: push: branches: - - main # Anpassen, falls du andere Branches verwenden möchtest + - main jobs: build: @@ -12,24 +12,28 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - + - name: Set up JDK uses: actions/setup-java@v2 with: - java-version: '17' # Anpassen, falls eine andere JDK-Version verwendet werden soll - + java-version: '17' + distribution: 'adopt' # Hier wird die fehlende Eingabe "distribution" hinzugefügt + server-id: 'github' + server-username: ${{ github.actor }} + server-password: ${{ secrets.GITHUB_TOKEN }} + - name: Build Java project with Maven - run: mvn clean package # Anpassen, falls weitere Maven-Optionen benötigt werden + run: mvn clean package - name: Create builds directory run: mkdir -p builds - name: Copy built JAR file - run: cp -r target/*.jar builds/ # Anpassen, je nachdem, wo deine gebauten Dateien sind + run: cp -r target/*.jar builds/ - name: Update version.txt run: | - sed -i 's/old_text/new_text/g' ver/version.txt # Anpassen der alten und neuen Texte + sed -i 's/old_text/new_text/g' ver/version.txt git add ver/version.txt builds/*.jar git commit -m "Updated version and built JAR file" git push From 13dce4720b1734fff7b01457697ff7060e5f2cc6 Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 02:31:49 +0100 Subject: [PATCH 11/11] Update maven.yml --- .github/workflows/maven.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index fe5abc9..411c08f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -17,7 +17,7 @@ jobs: uses: actions/setup-java@v2 with: java-version: '17' - distribution: 'adopt' # Hier wird die fehlende Eingabe "distribution" hinzugefügt + distribution: 'adopt' server-id: 'github' server-username: ${{ github.actor }} server-password: ${{ secrets.GITHUB_TOKEN }} @@ -25,15 +25,22 @@ jobs: - name: Build Java project with Maven run: mvn clean package + - name: Check if JAR files exist + run: | + if [ ! -d "target" ] || [ -z "$(ls -A target/*.jar)" ]; then + echo "No JAR files found in target directory or target directory does not exist." + exit 1 + fi + - name: Create builds directory run: mkdir -p builds - - name: Copy built JAR file + - name: Copy built JAR files run: cp -r target/*.jar builds/ - name: Update version.txt run: | sed -i 's/old_text/new_text/g' ver/version.txt git add ver/version.txt builds/*.jar - git commit -m "Updated version and built JAR file" + git commit -m "Updated version and built JAR files" git push