Update maven.yml - autorelease #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CI with Maven and Release | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- 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 | |
# Zapisz zbudowany artefakt | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: minecraft-plugin | |
path: target/*.jar # Zakładając, że plik .jar jest w katalogu target | |
# Opcjonalnie, jeśli chcesz automatycznie tworzyć release'y tylko przy pushach na mastera, możesz dodać kolejny job | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: minecraft-plugin | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: 'minecraft-plugin/*.jar' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |