From 63bb2574659df7422ccbb08c37b2cbfaa3ff7039 Mon Sep 17 00:00:00 2001 From: potzplitz <127513690+potzplitz@users.noreply.github.com> Date: Sun, 3 Mar 2024 00:04:54 +0100 Subject: [PATCH] Update maven.yml --- .github/workflows/maven.yml | 41 ++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 437cc7e..4bae9cf 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,28 +1,45 @@ -name: Automatisches Release +name: Java CI with Maven and Release on: push: - tags: - - 'v*' + branches: [ "main" ] + pull_request: + branches: [ "main" ] jobs: build: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 - # Fügen Sie hier Ihre Build-Schritte ein... - - release: + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Update dependency graph + uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 + + create_release: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Erstellen eines Releases + - uses: actions/checkout@v3 + - name: Generate tag + id: tag + run: echo "::set-output name=tag::$(date +'%Y%m%d%H%M%S')" + - name: Create Release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ secrets.project_token }} # Ersetzen Sie GITHUB_PAT durch den Namen Ihres Secrets + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.ref_name }} - release_name: Release ${{ github.ref_name }} + tag_name: ${{ steps.tag.outputs.tag }} + release_name: Release ${{ steps.tag.outputs.tag }} draft: false prerelease: false