|
11 | 11 | BRANCH_NAME: main |
12 | 12 | secrets: |
13 | 13 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 14 | + |
| 15 | + tag_release: |
| 16 | + needs: quality_checks |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + ref: ${{ env.BRANCH_NAME }} |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + # using git commit sha for version of action to ensure we have stable version |
| 26 | + - name: Install asdf |
| 27 | + uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 |
| 28 | + with: |
| 29 | + asdf_branch: v0.11.3 |
| 30 | + |
| 31 | + - name: Cache asdf |
| 32 | + uses: actions/cache@v4 |
| 33 | + with: |
| 34 | + path: | |
| 35 | + ~/.asdf |
| 36 | + key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }} |
| 37 | + restore-keys: | |
| 38 | + ${{ runner.os }}-asdf- |
| 39 | +
|
| 40 | + - name: Install asdf dependencies in .tool-versions |
| 41 | + uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 |
| 42 | + with: |
| 43 | + asdf_branch: v0.11.3 |
| 44 | + env: |
| 45 | + PYTHON_CONFIGURE_OPTS: --enable-shared |
| 46 | + |
| 47 | + - name: Install node packages |
| 48 | + run: | |
| 49 | + make install-node |
| 50 | +
|
| 51 | + - name: Set VERSION_TAG env var to be short git SHA and get next tag varsion |
| 52 | + id: output_version_tag |
| 53 | + run: | |
| 54 | + VERSION_TAG=$(git rev-parse --short HEAD) |
| 55 | + npx semantic-release --dry-run > semantic-release-output.log |
| 56 | + NEXT_VERSION=$(grep -i 'The next release version is' semantic-release-output.log | sed -E 's/.* ([[:digit:].]+)$/\1/') |
| 57 | + if [ -z "${NEXT_VERSION}" ] |
| 58 | + then |
| 59 | + echo "Could not get next tag. Here is the log from semantic-release" |
| 60 | + cat semantic-release-output.log |
| 61 | + exit 1 |
| 62 | + fi |
| 63 | + tagFormat=$(jq -r .tagFormat .releaserc) |
| 64 | + if [ "${tagFormat}" = "null" ] |
| 65 | + then |
| 66 | + tagFormat="v\${version}" |
| 67 | + fi |
| 68 | + # disabling shellcheck as replace does not work |
| 69 | + # shellcheck disable=SC2001 |
| 70 | + NEW_VERSION_TAG=$(echo "$tagFormat" | sed "s/\${version}/$NEXT_VERSION/") |
| 71 | + echo "## VERSION TAG : ${VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY" |
| 72 | + echo "## NEXT TAG WILL BE : ${NEW_VERSION_TAG}" >> "$GITHUB_STEP_SUMMARY" |
| 73 | + echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_OUTPUT" |
| 74 | + echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV" |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ github.token }} |
0 commit comments