Update maven.yml

This commit is contained in:
potzplitz 2024-03-03 01:15:40 +01:00 committed by GitHub
parent 78937962b4
commit 324fe475b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,32 +3,42 @@ name: Build and Release Java Project
on: on:
push: push:
branches: branches:
- main # oder den Namen des Hauptbranchs Ihres Projekts - main
jobs: jobs:
build: build-and-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up JDK 17 - name: Set up JDK 17
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
java-version: '17' java-version: '17'
distribution: 'temurin' # AdoptOpenJDK wurde zu Eclipse Temurin distribution: 'temurin'
- name: Build with Maven - name: Build with Maven
run: mvn clean install run: mvn clean install
- name: Create Tag
run: |
git tag $(date +'%Y%m%d%H%M%S') -a -m "Generated tag from GitHub Actions"
git push --tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(date +'%Y%m%d%H%M%S')
- name: Create Release - name: Create Release
id: create_release id: create_release
uses: actions/create-release@v1 uses: actions/create-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ github.ref }} tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: Release ${{ github.ref }} release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false draft: false
prerelease: false prerelease: false