change the version #5
Workflow file for this run
This file contains 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 packages | |
on: | |
# release: | |
# types: [created] | |
push: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/[email protected] | |
- name: Get current version for clearinghouse | |
id: version_clearinghouse | |
run: | | |
CLEARINGHOUSE_VERSION=$(grep -oP 'version = "\K[0-9]+\.[0-9]+\.[0-9]+' lib/clearinghouse/build.gradle.kts) | |
echo "clearinghouse_version=$CLEARINGHOUSE_VERSION" >> $GITHUB_OUTPUT | |
- name: Bump patch version for clearinghouse | |
id: bump_clearinghouse_version | |
run: | | |
CLEARINGHOUSE_VERSION="${{ steps.version_clearinghouse.outputs.clearinghouse_version }}" | |
VERSION_PARTS=(${CLEARINGHOUSE_VERSION//./ }) | |
MAJOR=${VERSION_PARTS[0]} | |
MINOR=${VERSION_PARTS[1]} | |
PATCH=${VERSION_PARTS[2]} | |
# Increment the patch version | |
PATCH=$((PATCH + 1)) | |
NEW_CLEARINGHOUSE_VERSION="$MAJOR.$MINOR.$PATCH" | |
echo "new_clearinghouse_version=$NEW_CLEARINGHOUSE_VERSION" >> $GITHUB_OUTPUT | |
- name: Release clearinghouse | |
run: | | |
./gradlew :lib:clearinghouse:build | |
./gradlew :lib:clearinghouse:publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update version in clearinghouse's build.gradle.kts | |
if: success() | |
run: | | |
sed -i "s#version = \".*\"#version = \"${{ steps.bump_clearinghouse_version.outputs.new_clearinghouse_version }}\"#" lib/clearinghouse/build.gradle.kts | |