ExtremeDemonList/.github/workflows/maven.yml
2024-03-03 02:12:38 +01:00

66 lines
1.8 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: 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