Deploy Latest Release JARs to GitHub Packages #8
This file contains hidden or 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: Deploy Latest Release JARs to GitHub Packages | |
| on: | |
| release: | |
| types: [published] # Automatisch bei neuem Release | |
| workflow_dispatch: # Manuell auslösbar | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Download latest release assets | |
| uses: robinraju/release-downloader@v1.9 | |
| with: | |
| repository: AbUndMax/Java_ArgsParser | |
| latest: true | |
| fileName: "ArgsParser_*.jar" # Holt alle JARs (ohne doppeltes v!) | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Get Release Tag Name (cleaned) | |
| id: get_tag | |
| run: | | |
| tag_name=$(curl -s https://api.github.com/repos/AbUndMax/Java_ArgsParser/releases/latest | jq -r .tag_name) | |
| echo "release_tag=$tag_name" >> $GITHUB_OUTPUT | |
| - name: Create minimal valid POM | |
| run: | | |
| echo '<?xml version="1.0" encoding="UTF-8"?>' > pom.xml | |
| echo '<project xmlns="http://maven.apache.org/POM/4.0.0"' >> pom.xml | |
| echo ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' >> pom.xml | |
| echo ' xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">' >> pom.xml | |
| echo ' <modelVersion>4.0.0</modelVersion>' >> pom.xml | |
| echo ' <groupId>com.github.AbUndMax</groupId>' >> pom.xml | |
| echo ' <artifactId>dummy</artifactId>' >> pom.xml | |
| echo ' <version>1.0.0</version>' >> pom.xml | |
| echo '</project>' >> pom.xml | |
| - name: Deploy JARs to GitHub Packages | |
| run: mvn deploy:deploy-file \ | |
| -Dfile=ArgsParser_${{ steps.get_tag.outputs.release_tag }}.jar \ | |
| -DgroupId=com.github.AbUndMax \ | |
| -DartifactId=Java_ArgsParser \ | |
| -Dversion=${{ steps.get_tag.outputs.release_tag }} \ | |
| -Dpackaging=jar \ | |
| -Dsources=ArgsParser_${{ steps.get_tag.outputs.release_tag }}-src.jar \ | |
| -Djavadoc=ArgsParser_${{ steps.get_tag.outputs.release_tag }}-doc.jar \ | |
| -DrepositoryId=github \ | |
| -Durl=https://maven.pkg.github.com/AbUndMax/Java_ArgsParser | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |