55 lines
1.6 KiB
YAML
55 lines
1.6 KiB
YAML
name: Build und Veröffentlichen des Java-Projekts
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout des Codes
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setze JDK 17 ein
|
|
uses: actions/setup-java@v2
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
|
|
- name: Konfiguriere Git-Benutzer
|
|
run: |
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
|
|
- 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: ${{ steps.create_release.outputs.upload_url }} # Provide the upload URL obtained from create-release action
|
|
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
|