Patch (#58) to 1.0.5 #23
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: | |
| - 'v*' | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/[email protected] | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Extract version from tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Set version from tag | |
| env: | |
| VERSION: ${{ steps.get_version.outputs.VERSION }} | |
| run: | | |
| echo "version=$VERSION" > gradle.properties | |
| echo "gradle.properties criado:" | |
| cat gradle.properties | |
| - name: Set up JDK 21 | |
| uses: actions/[email protected] | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: validate specs | |
| run: ./gradlew specsValidation | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| - name: Validate Maven Central credentials | |
| run: | | |
| if [ -z "${{ secrets.MAVEN_CENTRAL_TOKEN }}" ]; then | |
| echo "❌ MAVEN_CENTRAL_TOKEN secret is not set" | |
| exit 1 | |
| fi | |
| echo "✅ Maven Central token is set (length: ${#MAVEN_CENTRAL_TOKEN})" | |
| env: | |
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
| - name: Check curl version | |
| run: curl --version | |
| - name: Publish to Maven Central | |
| run: ./gradlew publishToMavenCentral | |
| env: | |
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Update README version | |
| run: | | |
| VERSION=${{ steps.get_version.outputs.VERSION }} | |
| sed -i "s/jtoon:[0-9]\+\.[0-9]\+\.[0-9]\+/jtoon:$VERSION/g" README.md | |
| sed -i "s/<version>[0-9]\+\.[0-9]\+\.[0-9]\+<\/version>/<version>$VERSION<\/version>/g" README.md | |
| - name: Commit README changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add README.md build.gradle | |
| git diff --staged --quiet || git commit -m "docs: update version to ${{ steps.get_version.outputs.VERSION }} in README" | |
| git push origin main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: softprops/[email protected] | |
| with: | |
| files: build/libs/*.jar | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(steps.get_version.outputs.VERSION, '-') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate JaCoCo Badge | |
| uses: cicirello/[email protected] | |
| with: | |
| generate-branches-badge: true | |
| jacoco-csv-file: build/customJacocoReportDir/test/jacocoTestReport.csv | |
| - name: Update Jacoco Badge | |
| uses: test-room-7/[email protected] | |
| with: | |
| file-path: .github/badges/jacoco.svg | |
| commit-msg: Update Jacoco Badge | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload build artifacts | |
| uses: actions/[email protected] | |
| if: always() | |
| with: | |
| name: build-artifacts | |
| path: | | |
| build/libs/*.jar | |
| build/reports/tests/test/ | |
| retention-days: 30 |