From 0972e6e8518b1eed50867b2dbd12d8dc470e2c29 Mon Sep 17 00:00:00 2001 From: BetterBox <53705390+Grzybol@users.noreply.github.com> Date: Sun, 17 Mar 2024 03:30:06 +0100 Subject: [PATCH] Update maven.yml --- .github/workflows/maven.yml | 51 +++++-------------------------------- 1 file changed, 6 insertions(+), 45 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 3530f40..2fa8f4a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,60 +1,31 @@ name: Java CI with Maven, Auto-Versioning, and Release - +# on: push: branches: [ "master" ] - permissions: contents: write - jobs: - setup: + build-and-release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 # To ensure tags are fetched as well token: ${{ secrets.GITHUB_TOKEN }} # Użyj GITHUB_TOKEN do checkout - - set-up-jdk: - runs-on: ubuntu-latest - needs: setup - steps: - name: Set up JDK 17 uses: actions/setup-java@v3 with: java-version: '17' distribution: 'temurin' cache: maven - - move-pom: - runs-on: ubuntu-latest - needs: [setup, set-up-jdk] - steps: - - name: Move pom.xml to workspace - run: mv /home/runner/work/BetterElo/BetterElo/pom.xml $GITHUB_WORKSPACE/ - - build: - runs-on: ubuntu-latest - needs: [setup, set-up-jdk, move-pom] - steps: - name: Build with Maven and Auto-Versioning run: mvn -B build-helper:parse-version versions:set versions:commit package --file pom.xml - - upload-artifact: - runs-on: ubuntu-latest - needs: build - steps: - name: Upload Artifact uses: actions/upload-artifact@v3 with: name: minecraft-plugin path: target/*.jar - - extract-info: - runs-on: ubuntu-latest - needs: upload-artifact - steps: - name: Extract version and artifact name id: extract_info run: | @@ -63,27 +34,17 @@ jobs: VERSION=$(echo $ARTIFACT_NAME | grep -oP '(?<=-)\d+\.\d+\.\d+(?=-SNAPSHOT)') echo "::set-output name=version::v$VERSION" echo "::set-output name=artifact_name::$ARTIFACT_NAME" - - create-tag: - runs-on: ubuntu-latest - needs: extract-info - steps: - name: Create and Push Tag run: | git config user.name "GitHub Actions" git config user.email "github-actions@users.noreply.github.com" - git tag ${{ needs.extract-info.outputs.version }} - git push https://x-access-token:${{ secrets.BE_ACCESS_TOKEN }}@github.com/${{ github.repository }} ${{ needs.extract-info.outputs.version }} - - create-release: - runs-on: ubuntu-latest - needs: create-tag - steps: + git tag ${{ steps.extract_info.outputs.version }} + git push https://x-access-token:${{ secrets.BE_ACCESS_TOKEN }}@github.com/${{ github.repository }} ${{ steps.extract_info.outputs.version }} - name: Create Release uses: softprops/action-gh-release@v1 with: - name: ${{ needs.extract-info.outputs.artifact_name }} - tag_name: ${{ needs.extract-info.outputs.version }} + name: ${{ steps.extract_info.outputs.artifact_name }} + tag_name: ${{ steps.extract_info.outputs.version }} files: target/*.jar generate_release_notes: true env: