diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 6819189..344c385 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,17 +1,15 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven - name: Java CI with Maven on: push: branches: [ "main" ] + tags: + - 'v*.*.*' pull_request: branches: [ "main" ] jobs: build: - runs-on: ubuntu-latest steps: @@ -28,13 +26,36 @@ jobs: run: mvn -B package working-directory: main - # Generate dependency graph explicitly (run step supports -f) + - name: Upload built JAR + uses: actions/upload-artifact@v4 + with: + name: package + path: main/target/*.jar + - name: Generate dependency graph run: mvn -B -f main/pom.xml com.github.ferstl:depgraph-maven-plugin:4.0.1:graph - # Upload the generated dependency files so you can inspect them in the workflow run - name: Upload dependency graph artifact uses: actions/upload-artifact@v4 with: name: dependency-graph path: main/target/** + + publish-release: + runs-on: ubuntu-latest + needs: [build] + if: startsWith(github.ref, 'refs/tags/') + permissions: + contents: write + + steps: + - name: Download built JAR + uses: actions/download-artifact@v4 + with: + name: package + path: main/target/ + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: main/target/*.jar