.gitea/workflows/release.yml aktualisiert

This commit is contained in:
Steev 2024-12-27 04:23:28 +01:00
parent ca3a3de361
commit 149c81dce0

View File

@ -3,63 +3,59 @@ name: Build and Release Minecraft Plugin
on:
push:
branches:
- release
- testing
jobs:
build:
build-and-release:
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v2
# Repository auschecken
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Java 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt' # Verwenden Sie 'adopt' für Java 17
# Java 17 installieren
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Update Apt
run: apt update -y
# Maven installieren
- name: Install Maven
run: |
sudo apt-get update
sudo apt-get install -y maven
- name: Update CA certificates
run: apt-get install --reinstall ca-certificates -y
# Plugin-Version aus plugin.yml auslesen
- name: Extract Plugin Version
id: extract_version
run: |
VERSION=$(grep '^version:' src/main/resources/plugin.yml | awk '{print $2}')
echo "PLUGIN_VERSION=$VERSION" >> $GITHUB_ENV
- name: Install Maven
run: apt install maven -y
# Projekt mit Maven bauen
- name: Build with Maven
run: mvn clean package
- name: Build with Maven
run: mvn clean install
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: BetterMinecraft-stable.jar
path: target/BetterMinecraft-stable.jar
steps:
- name: Checkout Repository
uses: actions/checkout@v2
# JAR-Datei umbenennen
- name: Rename JAR File
run: |
mv target/*.jar target/BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
- name: Get letzte Release-Version
id: get_version
run: echo "::set-output name=version::$(git describe --tags --abbrev=0 || echo '0.0.0')"
# Artefakt hochladen
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
path: target/BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
- name: Incrementiere Version
id: increment_version
run: |
IFS='.' read -ra VERSION <<< "${{ steps.get_version.outputs.version }}"
MAJOR="${VERSION[0]}"
MINOR="${VERSION[1]}"
PATCH="${VERSION[2]}"
echo "::set-output name=major::$(($MAJOR + 1))"
echo "::set-output name=minor::$(($MINOR + 1))"
echo "::set-output name=patch::$(($PATCH + 1))"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
target/BetterMinecraft-stable.jar
tag_name: ${{ steps.increment_version.outputs.major }}.${{ steps.increment_version.outputs.minor }}.${{ steps.increment_version.outputs.patch }}
release_name: Release ${{ steps.increment_version.outputs.major }}.${{ steps.increment_version.outputs.minor }}.${{ steps.increment_version.outputs.patch }}
draft: false
prerelease: false
# Release erstellen
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: target/BetterMinecraft-${{ env.PLUGIN_VERSION }}-b.jar
tag_name: ${{ env.PLUGIN_VERSION }}
release_name: Release ${{ env.PLUGIN_VERSION }}
draft: false
prerelease: true