converter-2.6.2 #136
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 library package on release | |
| on: | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| build_library: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v2 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Grant execute permission for Gradlew | |
| run: chmod +x gradlew | |
| - name: Extract release information | |
| id: extract_info | |
| run: | | |
| RELEASE_NAME=${{ github.event.release.name }} | |
| echo $RELEASE_NAME | |
| if [[ "$RELEASE_NAME" == converter-* ]]; then | |
| PROJECT="converter" | |
| VERSION=${RELEASE_NAME#converter-} | |
| else | |
| PROJECT="library" | |
| VERSION=$RELEASE_NAME | |
| fi | |
| PATTERN="^([0-9]+\.[0-9]+(\.[0-9]+)?)(-[A-Za-z0-9\.]+)*$" | |
| if [[ ! "$VERSION" =~ $PATTERN ]]; then | |
| echo "Invalid version number" | |
| exit 1 | |
| fi | |
| echo "::set-output name=project::$PROJECT" | |
| echo "::set-output name=version::$VERSION" | |
| - name: Validate X.Y or X.Y.Z version format for Maven publishing | |
| id: validate_xyz | |
| run: | | |
| VERSION=${{ steps.extract_info.outputs.version }} | |
| if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then | |
| echo "::set-output name=is_xyz_version::true" | |
| echo "Version $VERSION matches X.Y or X.Y.Z format - Maven publishing will proceed" | |
| else | |
| echo "::set-output name=is_xyz_version::false" | |
| echo "Version $VERSION does not match X.Y or X.Y.Z format - Maven publishing will be skipped" | |
| fi | |
| - name: Build, run tests and publish library | |
| if: steps.extract_info.outputs.project == 'library' && steps.validate_xyz.outputs.is_xyz_version == 'true' | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: ./gradlew -Pversion=${{ steps.extract_info.outputs.version }} publish |