From ddfd22577da129a9e3cdd42ffbc011c40d11a6f0 Mon Sep 17 00:00:00 2001 From: Enguerrand Allamel Date: Thu, 29 Aug 2024 11:02:47 +0200 Subject: [PATCH] chore: Refactor release.yaml workflow to use environment variables --- .github/workflows/release.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8d09fd6..cf748a8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -67,15 +67,15 @@ jobs: RELEASE_OUTPUTS: ${{ toJson(steps.release.outputs) }} shell: bash run: | - PATHS_RELEASED=$(echo "$RELEASE_OUTPUTS" | jq -r '.paths_released' | sed 's/[][]//g' | tr -d '"') + PATHS_RELEASED=$(echo "${{ env.RELEASE_OUTPUTS }}" | jq -r '.paths_released' | sed 's/[][]//g' | tr -d '"') TAG_NAME_KEY="${PATHS_RELEASED}--tag_name" - TAG_NAME=$(echo "$RELEASE_OUTPUTS" | jq -r --arg key "$TAG_NAME_KEY" '.[$key]') + TAG_NAME=$(echo "${{ env.RELEASE_OUTPUTS }}" | jq -r --arg key "$TAG_NAME_KEY" '.[$key]') MAJOR_KEY="${PATHS_RELEASED}--major" - MAJOR_VERSION=$(echo "$RELEASE_OUTPUTS" | jq -r --arg key "$MAJOR_KEY" '.[$key]') + MAJOR_VERSION=$(echo "${{ env.RELEASE_OUTPUTS }}" | jq -r --arg key "$MAJOR_KEY" '.[$key]') MINOR_KEY="${PATHS_RELEASED}--minor" - MINOR_VERSION=$(echo "$RELEASE_OUTPUTS" | jq -r --arg key "$MINOR_KEY" '.[$key]') + MINOR_VERSION=$(echo "${{ env.RELEASE_OUTPUTS }}" | jq -r --arg key "$MINOR_KEY" '.[$key]') MAJOR_MINOR_TAG="${PATHS_RELEASED}-${MAJOR_VERSION}.${MINOR_VERSION}" MAJOR_TAG="${PATHS_RELEASED}-${MAJOR_VERSION}" @@ -90,7 +90,7 @@ jobs: if: ${{ steps.release.outputs.releases_created }} env: TAG_MAJOR_MINOR: ${{ steps.prepare-major-minor-tags.outputs.tag_major_minor }} - TAG_MAJOR: ${{ steps.prepare-major-minor-tags.outputs.tag_major_minor }} + TAG_MAJOR: ${{ steps.prepare-major-minor-tags.outputs.tag_major }} with: github-token: ${{ steps.ghapp-cybersecurity-ci.outputs.token }} script: | @@ -98,14 +98,14 @@ jobs: github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, - ref: 'refs/tags/$TAG_MAJOR', + ref: 'refs/tags/${{ env.TAG_MAJOR }}', sha: context.sha }).catch(err => { if (err.status !== 422) throw err; github.rest.git.updateRef({ owner: context.repo.owner, repo: context.repo.repo, - ref: 'tags/$TAG_MAJOR', + ref: 'tags/${{ env.TAG_MAJOR }}', sha: context.sha }); }) @@ -113,14 +113,14 @@ jobs: github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, - ref: 'refs/tags/$TAG_MAJOR_MINOR', + ref: 'refs/tags/${{ env.TAG_MAJOR_MINOR }}', sha: context.sha }).catch(err => { if (err.status !== 422) throw err; github.rest.git.updateRef({ owner: context.repo.owner, repo: context.repo.repo, - ref: 'tags/$TAG_MAJOR_MINOR', + ref: 'tags/${{ env.TAG_MAJOR_MINOR }}', sha: context.sha }); })