optimize pom.xml #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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # required for softprops/action-gh-release to create the release | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 11 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: GPG_PASSPHRASE | |
| - name: Set version from tag | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| # Accept v1.2.3, testingbotrest-1.2.3, or a bare 1.2.3 | |
| TAG_VERSION=${TAG#v} | |
| TAG_VERSION=${TAG_VERSION#testingbotrest-} | |
| echo "Releasing version ${TAG_VERSION} (from tag ${TAG})" | |
| mvn -B versions:set -DnewVersion=${TAG_VERSION} -DgenerateBackupPoms=false | |
| - name: Run tests | |
| run: mvn -B test | |
| env: | |
| TB_KEY: ${{ secrets.TB_KEY }} | |
| TB_SECRET: ${{ secrets.TB_SECRET }} | |
| - name: Publish to Maven Central | |
| run: mvn -B clean deploy -DskipTests | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Upload artifacts to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| target/testingbotrest-*.jar | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |