From d9d181dd6c281016d96d6b5f08f3cca058c6cb3a Mon Sep 17 00:00:00 2001 From: Daryl Todosichuk Date: Tue, 22 Oct 2024 09:57:12 -0700 Subject: [PATCH] Set env body --- .github/workflows/docker-build-main.yml | 52 +++++++------------------ applications/scripts/datafix-ab#001.sql | 3 +- 2 files changed, 15 insertions(+), 40 deletions(-) diff --git a/.github/workflows/docker-build-main.yml b/.github/workflows/docker-build-main.yml index dd2180b..b2eb8f2 100644 --- a/.github/workflows/docker-build-main.yml +++ b/.github/workflows/docker-build-main.yml @@ -30,9 +30,8 @@ env: UGM_BUILD_VERSION: ${{vars.UGM_BUILD_VERSION}} UGM_BUILD_REVISION: ${{vars.UGM_BUILD_REVISION}} - RELEASE_PREFIX: API_v - RELEASE_MESSAGE: Test - RELEASE_VERSION: ${{vars.UGM_BUILD_VERSION}} + UGM_RELEASE_PREFIX: API_v + UGM_RELEASE_MESSAGE: Test # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -68,54 +67,29 @@ jobs: id: tag-selector run: | # Extract the major and minor version parts using grep - MAJOR_MINOR_VERSION=$(echo "${{env.RELEASE_VERSION}}" | grep -oE '^[0-9]+\.[0-9]+') - # Extract the latest patch version for the given major.minor version - VERSION_PATCH=$(git tag --list "${{env.RELEASE_PREFIX}}${MAJOR_MINOR_VERSION}.*" --sort=-version:refname | head -n 1 | grep -oE '[0-9]+$') - if [ -z "$VERSION_PATCH" ]; then - VERSION_PATCH=0 - else - VERSION_PATCH=$((VERSION_PATCH + 1)) - fi + MAJOR_VERSION=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '^[0-9]+`) + MINOR_VERSION=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '\.[0-9]+' | grep -oE '[0-9]+') + VERSION_PATCH=$(echo "${{env.UGM_BUILD_VERSION}}" | grep -oE '[0-9]+$') + VERSION_PATCH=$((VERSION_PATCH + 1)) # Construct the new tag - NEW_TAG="${{env.RELEASE_PREFIX}}${MAJOR_MINOR_VERSION}.${VERSION_PATCH}" + NEW_TAG="${{env.UGM_RELEASE_PREFIX}}${MAJOR_VERSION}.${MINOR_VERSION}.${VERSION_PATCH}" echo "gittag=${NEW_TAG}" >> $GITHUB_OUTPUT - echo "tagmsg=${{env.RELEASE_MESSAGE}} ${{steps.date-selector.outputs.date}}" >> $GITHUB_OUTPUT - echo "tagpatch=${VERSION_PATCH}" >> $GITHUB_OUTPUT + echo "tagmsg=${{env.UGM_RELEASE_MESSAGE}} ${{steps.date-selector.outputs.date}}" >> $GITHUB_OUTPUT + echo "tagversion=${MAJOR_VERSION}.${MINOR_VERSION}.${VERSION_PATCH}" >> $GITHUB_OUTPUT - name: Create Git Tag run: | git config user.name "GitHub Actions 1" git config user.email "github-actions@users.noreply.github.com" git tag -a "${{steps.tag-selector.outputs.gittag}}" -m "${{steps.tag-selector.outputs.tagmsg}}" git push origin "${{steps.tag-selector.outputs.gittag}}" + - name: Set repository version variable + id: setversion + run: | + gh variable set UGM_BUILD_VERSION --env test --body "${{steps.tag-selector.outputs.tagversion}}" outputs: TAGNAME: ${{steps.tag-selector.outputs.gittag}} TAGMESSAGE: ${{steps.tag-selector.outputs.tagmsg}} TAGPATCH: ${{steps.tag-selector.outputs.tagpatch}} - PushTag: - needs: [GenerateTag] - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: '1' - - name: Push Git Tag - id: settag - env: - TAGNAME: ${{needs.GenerateTag.outputs.TAGNAME}} - TAGMESSAGE: ${{needs.GenerateTag.outputs.TAGMESSAGE}} - run: | - git config user.name "GitHub Actions 2" - git config user.email "github-actions@users.noreply.github.com" - git tag ${{env.TAGNAME}} -m "${{env.TAGMESSAGE}}" - git push origin ${{env.TAGNAME}} - - name: Set repository patch variable - id: setpatch - env: - TAGPATCH: ${{needs.GenerateTag.outputs.TAGPATCH}} - run: | - gh variable set VERSION_PATCH --body "${{env.TAGPATCH}}" - gh variable list build: runs-on: ubuntu-latest environment: test diff --git a/applications/scripts/datafix-ab#001.sql b/applications/scripts/datafix-ab#001.sql index a9e0060..9a9988b 100644 --- a/applications/scripts/datafix-ab#001.sql +++ b/applications/scripts/datafix-ab#001.sql @@ -5,4 +5,5 @@ test4 test5 test6 test7 -test8 \ No newline at end of file +test8 +test9 \ No newline at end of file