Release v1.5.11 #12
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'audd-java/v*' | |
| - 'v*' | |
| permissions: | |
| contents: read | |
| packages: write # for GitHub Packages Maven push | |
| jobs: | |
| publish: | |
| name: Build and publish to Maven Central | |
| runs-on: ubuntu-latest | |
| environment: maven-central | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '21' | |
| cache: maven | |
| server-id: central | |
| server-username: MAVEN_CENTRAL_USERNAME | |
| server-password: MAVEN_CENTRAL_PASSWORD | |
| gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Verify GPG key import | |
| run: | | |
| gpg --list-secret-keys --keyid-format=long | |
| gpg --list-keys --keyid-format=long | |
| - name: Verify build | |
| run: mvn -B verify | |
| - name: Deploy to Maven Central | |
| env: | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| run: mvn -B -Prelease deploy -DskipTests | |
| - name: Configure Maven settings for GitHub Packages | |
| env: | |
| GH_USER: ${{ github.actor }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| mkdir -p ~/.m2 | |
| cat > ~/.m2/settings-github.xml <<'EOF' | |
| <settings> | |
| <servers> | |
| <server> | |
| <id>github</id> | |
| <username>${env.GH_USER}</username> | |
| <password>${env.GH_TOKEN}</password> | |
| </server> | |
| </servers> | |
| </settings> | |
| EOF | |
| - name: Deploy to GitHub Packages | |
| env: | |
| GH_USER: ${{ github.actor }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Reuses the artifacts already in target/ from the Maven Central deploy. | |
| run: | | |
| set -e | |
| jar=$(ls target/audd-java-*.jar | grep -v -- '-sources.jar' | grep -v -- '-javadoc.jar' | head -1) | |
| src=$(ls target/audd-java-*-sources.jar | head -1) | |
| doc=$(ls target/audd-java-*-javadoc.jar | head -1) | |
| mvn -B --settings ~/.m2/settings-github.xml deploy:deploy-file \ | |
| -DpomFile=pom.xml \ | |
| -Dfile="$jar" \ | |
| -Dsources="$src" \ | |
| -Djavadoc="$doc" \ | |
| -DrepositoryId=github \ | |
| -Durl=https://maven.pkg.github.com/AudDMusic/audd-java |