From ef33bf0d55d8668c07a4f3763bda9442b3cac9ef Mon Sep 17 00:00:00 2001 From: Nolij Date: Sat, 30 Sep 2023 13:47:41 -0400 Subject: [PATCH] Revert "yes, rico. kaboom." This reverts commit b6ef6546aa69ccf154864be174efe9dcd41cedb5. --- .github/workflows/publish.yml | 26 +++++++++++++++++++------- bump_version.sh | 26 -------------------------- felt-spindle/build.gradle | 8 ++++++++ 3 files changed, 27 insertions(+), 33 deletions(-) delete mode 100755 bump_version.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2f880f7..47ebd06 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,15 +13,27 @@ jobs: steps: - uses: actions/checkout@v3 - uses: gradle/wrapper-validation-action@v1 - - - name: Bump Version - run: ./bump_version.sh; - env: - BASE_VERSION: ${{ vars.BASE_VERSION }} - PATCH_VERSION: ${{ vars.PATCH_VERSION }} - name: Publish to Maven - run: ./gradlew build :felt-spindle:publish -x test --stacktrace; + run: | + ./gradlew build :felt-spindle:publish -x test --stacktrace; + gh api \ + --method PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + ${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/variables/BASE_VERSION \ + -f name='BASE_VERSION' \ + -f value="${BASE_VERSION}"; + gh api \ + --method PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + ${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/variables/PATCH_VERSION \ + -f name='PATCH_VERSION' \ + -f value="${PATCH_VERSION}"; env: + CI: true + BASE_VERSION: ${{ vars.BASE_VERSION }} + PATCH_VERSION: ${{ vars.PATCH_VERSION }} MAVEN_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PUBLISH_TOKEN }} \ No newline at end of file diff --git a/bump_version.sh b/bump_version.sh deleted file mode 100755 index 7470f85..0000000 --- a/bump_version.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -NEW_BASE_VERSION="$(grep "^base_version=" ./felt-spindle/gradle.properties | cut -d'=' -f2)"; -if [ "$BASE_VERSION" == "$NEW_BASE_VERSION" ]; then - (( PATCH_VERSION++ )); -else - gh api \ - --method PATCH \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/variables/BASE_VERSION" \ - -f name='BASE_VERSION' \ - -f value="${NEW_BASE_VERSION}"; - PATCH_VERSION=0; -fi - -gh api \ - --method PATCH \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/variables/PATCH_VERSION" \ - -f name='PATCH_VERSION' \ - -f value="${PATCH_VERSION}"; - -echo "BASE_VERSION=${NEW_BASE_VERSION}" | tee -a "$GITHUB_ENV"; -echo "PATCH_VERSION=${PATCH_VERSION}" | tee -a "$GITHUB_ENV"; diff --git a/felt-spindle/build.gradle b/felt-spindle/build.gradle index 7876bbf..3aab535 100644 --- a/felt-spindle/build.gradle +++ b/felt-spindle/build.gradle @@ -10,6 +10,14 @@ def baseVersion = project.base_version def ENV = System.getenv() if (ENV.CI) { + if (!ENV.BASE_VERSION) { + ENV.BASE_VERSION = baseVersion + ENV.PATCH_VERSION = 0 + } else if (!ENV.PATCH_VERSION || ENV.BASE_VERSION != baseVersion) { + ENV.PATCH_VERSION = 0 + } else { + ENV.PATCH_VERSION = Integer.parseInt(ENV.PATCH_VERSION) + 1 + } version = baseVersion + ENV.PATCH_VERSION } else { version = baseVersion + '.local'