Update maven.yml
This commit is contained in:
parent
05a67e8471
commit
a9435f20b2
1 changed files with 30 additions and 21 deletions
51
.github/workflows/maven.yml
vendored
51
.github/workflows/maven.yml
vendored
|
@ -1,34 +1,43 @@
|
||||||
name: Java CI with Maven and Release
|
name: Build and Release Java Project
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches:
|
||||||
pull_request:
|
- main # oder den Namen des Hauptbranchs Ihres Projekts
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
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 11
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
java-version: '11'
|
||||||
distribution: 'temurin'
|
distribution: 'adopt'
|
||||||
cache: maven
|
|
||||||
|
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn -B package --file pom.xml
|
run: mvn clean install
|
||||||
|
|
||||||
release:
|
- name: Create Release
|
||||||
name: "Release"
|
id: create_release
|
||||||
runs-on: "ubuntu-latest"
|
uses: actions/create-release@v1
|
||||||
steps:
|
env:
|
||||||
- uses: "marvinpinto/action-automatic-releases@latest"
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: Release ${{ github.ref }}
|
||||||
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
automatic_release_tag: "release-$(date +'%Y%m%d%H%M%S')"
|
|
||||||
|
- name: Upload Artifact to Release
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./target/your-artifact.jar
|
||||||
|
asset_name: your-artifact.jar
|
||||||
|
asset_content_type: application/java-archive
|
||||||
|
|
Loading…
Reference in a new issue