Update maven.yml

This commit is contained in:
potzplitz 2024-03-03 01:16:55 +01:00 committed by GitHub
parent 324fe475b2
commit 955c2ae92d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,42 +3,42 @@ name: Build and Release Java Project
on: on:
push: push:
branches: branches:
- main - main # oder den Namen des Hauptbranchs Ihres Projekts
jobs: jobs:
build-and-release: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Set up JDK 17 - name: Set up JDK 17
uses: actions/setup-java@v3 uses: actions/setup-java@v2
with: with:
java-version: '17' java-version: '17'
distribution: 'temurin' distribution: 'temurin'
- name: Configure Git User
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Create Git Tag
run: git tag $(date +'%Y%m%d%H%M%S') -a -m "Generated tag from GitHub Actions"
- name: Push Tags
run: git push --tags
- 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
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: ${{ steps.get_version.outputs.VERSION }} tag_name: $(git describe --tags --abbrev=0)
release_name: Release ${{ steps.get_version.outputs.VERSION }} release_name: Release $(git describe --tags --abbrev=0)
draft: false draft: false
prerelease: false prerelease: false