🛠️ Publish to Sonatype #1
Workflow file for this run
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: 🛠️ Publish to GitHub Packages | |
| on: | |
| release: | |
| types: [ published ] # Trigger workflow on release publish event | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Checkout the code and clone submodules | |
| - name: Checkout code and clone submodules | |
| uses: actions/checkout@v4 | |
| # Step 2: Set up JDK 21 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| # Step 3: Setup Gradle | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| with: | |
| cache-read-only: false | |
| # Step 4: Set version based on the release tag | |
| - name: Set version based on release tag | |
| run: echo VERSION=$(echo "${GITHUB_REF}" | sed 's/refs\/tags\///') >> $GITHUB_ENV | |
| # Step 5: Build the project using Gradle | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| # Step 6: Publish the project to GitHub Packages | |
| - name: Publish to GitHub Packages | |
| run: ./gradlew publish -Pversion=$VERSION | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication | |
| # Step 7: Send notification to Discord | |
| - name: Send notification to Discord | |
| uses: SethCohen/[email protected] | |
| with: | |
| webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| color: "391879" | |
| username: "Java SDK" |