Skip to content

Commit

Permalink
Fixing TAG_TYPE env for CI (#16442)
Browse files Browse the repository at this point in the history
  • Loading branch information
wallentx authored Sep 27, 2023
1 parent 04fa3b3 commit 2ffd471
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build-linux-installer-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,16 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check tag type
id: check_tag_type
shell: bash
run: |
REG_B="^[0-9]+\.[0-9]+\.[0-9]+-b[0-9]+$"
REG_RC="^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$"
if [[ "${{ github.event.release.tag_name }}" =~ $REG_B ]] || [[ "${{ inputs.release_type }}" =~ $REG_B ]]; then
echo "TAG_TYPE=beta" >> "$GITHUB_OUTPUT"
echo "TAG_TYPE=beta"
echo "TAG_TYPE=beta" >> "$GITHUB_ENV"
elif [[ "${{ github.event.release.tag_name }}" =~ $REG_RC ]] || [[ "${{ inputs.release_type }}" =~ $REG_RC ]]; then
echo "TAG_TYPE=rc" >> "$GITHUB_OUTPUT"
echo "TAG_TYPE=rc"
echo "TAG_TYPE=rc" >> "$GITHUB_ENV"
fi
# Create our own venv outside of the git directory JUST for getting the ACTUAL version so that install can't break it
Expand Down Expand Up @@ -142,7 +143,7 @@ jobs:
LATEST_RC=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+$"))) | first | .tag_name')
# Compare the versions and choose the newest that matches the requirements
if [[ "$TAG_TYPE" == "beta" || -z "${{ github.event.release.tag_name }}" ]]; then
if [[ "$TAG_TYPE" == "beta" || -z "$TAG_TYPE" ]]; then
# For beta or dev builds (indicated by the absence of a tag), use the latest version available
LATEST_VERSION=$(printf "%s\n%s\n%s\n" "$LATEST_RELEASE" "$LATEST_BETA" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1)
elif [[ "$TAG_TYPE" == "rc" ]]; then
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build-linux-installer-rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check tag type
id: check_tag_type
shell: bash
run: |
REG_B="^[0-9]+\.[0-9]+\.[0-9]+-b[0-9]+$"
REG_RC="^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$"
if [[ "${{ github.event.release.tag_name }}" =~ $REG_B ]] || [[ "${{ inputs.release_type }}" =~ $REG_B ]]; then
echo "TAG_TYPE=beta" >> "$GITHUB_OUTPUT"
echo "TAG_TYPE=beta"
echo "TAG_TYPE=beta" >> "$GITHUB_ENV"
elif [[ "${{ github.event.release.tag_name }}" =~ $REG_RC ]] || [[ "${{ inputs.release_type }}" =~ $REG_RC ]]; then
echo "TAG_TYPE=rc" >> "$GITHUB_OUTPUT"
echo "TAG_TYPE=rc"
echo "TAG_TYPE=rc" >> "$GITHUB_ENV"
fi
- uses: Chia-Network/actions/enforce-semver@main
Expand Down Expand Up @@ -133,7 +134,7 @@ jobs:
LATEST_RC=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+$"))) | first | .tag_name')
# Compare the versions and choose the newest that matches the requirements
if [[ "$TAG_TYPE" == "beta" || -z "${{ github.event.release.tag_name }}" ]]; then
if [[ "$TAG_TYPE" == "beta" || -z "$TAG_TYPE" ]]; then
# For beta or dev builds (indicated by the absence of a tag), use the latest version available
LATEST_VERSION=$(printf "%s\n%s\n%s\n" "$LATEST_RELEASE" "$LATEST_BETA" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1)
elif [[ "$TAG_TYPE" == "rc" ]]; then
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build-macos-installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,16 @@ jobs:
MACOSX_DEPLOYMENT_TARGET: 11

- name: Check tag type
id: check_tag_type
shell: bash
run: |
REG_B="^[0-9]+\.[0-9]+\.[0-9]+-b[0-9]+$"
REG_RC="^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$"
if [[ "${{ github.event.release.tag_name }}" =~ $REG_B ]] || [[ "${{ inputs.release_type }}" =~ $REG_B ]]; then
echo "TAG_TYPE=beta" >> "$GITHUB_OUTPUT"
echo "TAG_TYPE=beta"
echo "TAG_TYPE=beta" >> "$GITHUB_ENV"
elif [[ "${{ github.event.release.tag_name }}" =~ $REG_RC ]] || [[ "${{ inputs.release_type }}" =~ $REG_RC ]]; then
echo "TAG_TYPE=rc" >> "$GITHUB_OUTPUT"
echo "TAG_TYPE=rc"
echo "TAG_TYPE=rc" >> "$GITHUB_ENV"
fi
- name: Test for secrets access
Expand Down Expand Up @@ -166,7 +167,7 @@ jobs:
LATEST_RC=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+$"))) | first | .tag_name')
# Compare the versions and choose the newest that matches the requirements
if [[ "$TAG_TYPE" == "beta" || -z "${{ github.event.release.tag_name }}" ]]; then
if [[ "$TAG_TYPE" == "beta" || -z "$TAG_TYPE" ]]; then
# For beta or dev builds (indicated by the absence of a tag), use the latest version available
LATEST_VERSION=$(printf "%s\n%s\n%s\n" "$LATEST_RELEASE" "$LATEST_BETA" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1)
elif [[ "$TAG_TYPE" == "rc" ]]; then
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build-windows-installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,16 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check tag type
id: check_tag_type
shell: bash
run: |
REG_B="^[0-9]+\.[0-9]+\.[0-9]+-b[0-9]+$"
REG_RC="^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$"
if [[ "${{ github.event.release.tag_name }}" =~ $REG_B ]] || [[ "${{ inputs.release_type }}" =~ $REG_B ]]; then
echo "TAG_TYPE=beta" >> "$GITHUB_OUTPUT"
echo "TAG_TYPE=beta"
echo "TAG_TYPE=beta" >> "$GITHUB_ENV"
elif [[ "${{ github.event.release.tag_name }}" =~ $REG_RC ]] || [[ "${{ inputs.release_type }}" =~ $REG_RC ]]; then
echo "TAG_TYPE=rc" >> "$GITHUB_OUTPUT"
echo "TAG_TYPE=rc"
echo "TAG_TYPE=rc" >> "$GITHUB_ENV"
fi
- name: Set git urls to https instead of ssh
Expand Down Expand Up @@ -198,7 +199,7 @@ jobs:
LATEST_RC=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+$"))) | first | .tag_name')
# Compare the versions and choose the newest that matches the requirements
if [[ "$TAG_TYPE" == "beta" || -z "${{ github.event.release.tag_name }}" ]]; then
if [[ "$TAG_TYPE" == "beta" || -z "$TAG_TYPE" ]]; then
# For beta or dev builds (indicated by the absence of a tag), use the latest version available
LATEST_VERSION=$(printf "%s\n%s\n%s\n" "$LATEST_RELEASE" "$LATEST_BETA" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1)
elif [[ "$TAG_TYPE" == "rc" ]]; then
Expand Down

0 comments on commit 2ffd471

Please sign in to comment.