Update maven.yml
This commit is contained in:
parent
c57f233cc6
commit
63de173d61
1 changed files with 21 additions and 40 deletions
61
.github/workflows/maven.yml
vendored
61
.github/workflows/maven.yml
vendored
|
@ -1,55 +1,36 @@
|
||||||
name: Build und Veröffentlichen des Java-Projekts
|
name: Java Build and File Update
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main # Anpassen, falls du andere Branches verwenden möchtest
|
||||||
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: '11' # Anpassen, falls eine andere JDK-Version verwendet werden soll
|
||||||
distribution: 'temurin'
|
|
||||||
|
- name: Build Java project
|
||||||
- name: Konfiguriere Git-Benutzer
|
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "action@github.com"
|
./gradlew build # Anpassen, falls du ein anderes Build-Tool verwendest
|
||||||
git config --local user.name "GitHub Action"
|
|
||||||
|
- name: Create builds directory
|
||||||
|
run: mkdir -p builds
|
||||||
|
|
||||||
|
- name: Copy built JAR file
|
||||||
|
run: cp -r <path-to-your-build-output>/*.jar builds/ # Anpassen, je nachdem, wo deine gebauten Dateien sind
|
||||||
|
|
||||||
- name: Bestimme Versionsnummer
|
- name: Update version.txt
|
||||||
id: version
|
run: |
|
||||||
run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
|
sed -i 's/old_text/new_text/g' ver/version.txt # Anpassen der alten und neuen Texte
|
||||||
|
git add ver/version.txt builds/*.jar
|
||||||
- name: Erstelle Git-Tag
|
git commit -m "Updated version and built JAR file"
|
||||||
run: git tag v${{ steps.version.outputs.VERSION }} -a -m "Generierter Tag von GitHub Actions"
|
git push
|
||||||
|
|
||||||
- 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
|
|
||||||
|
|
Loading…
Reference in a new issue