Consolidate workflow to fetch bladebit (#15941)

* Consolidating bladebit fetch

* Using a portable sed command

* Whitespace
This commit is contained in:
William Allen 2023-08-05 05:16:22 -05:00 committed by GitHub
parent b1ecb5e154
commit 6c2c7bd6af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 104 additions and 213 deletions

View File

@ -116,58 +116,38 @@ jobs:
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot_k34
- name: Get latest bladebit plotter for Full Release
if: "github.event.release && !github.event.release.prerelease"
- name: Fetch bladebit versions
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
# Fetch the latest version of each type
LATEST_RELEASE=$(gh api repos/Chia-Network/bladebit/releases/latest --jq 'select(.prerelease == false) | .tag_name')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_RELEASE" -p 'bladebit*-ubuntu-arm64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest beta bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'beta'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BETA=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-beta[0-9]+$"))) | first | .tag_name')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_BETA" -p 'bladebit*-ubuntu-arm64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest RC bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'rc'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
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')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_RC" -p 'bladebit*-ubuntu-arm64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest bladebit plotter for Dev
if: "!github.event.release"
# Compare the versions and choose the newest that matches the requirements
if [[ "$TAG_TYPE" == "beta" || -z "${{ github.event.release.tag_name }}" ]]; 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
# For RC builds, use the latest RC or full release if it's newer
LATEST_VERSION=$(printf "%s\n%s\n" "$LATEST_RELEASE" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1)
else
# For full releases, use the latest full release
LATEST_VERSION="$LATEST_RELEASE"
fi
echo "LATEST_VERSION=$LATEST_VERSION" >> "$GITHUB_ENV"
- name: Get latest bladebit plotter
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BLADEBIT=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease and (.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-(beta|rc)[0-9]+$")))) | first | .tag_name')
# Download and extract the chosen version
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_BLADEBIT" -p 'bladebit*-ubuntu-arm64.tar.gz'
gh release download -R Chia-Network/bladebit "$LATEST_VERSION" -p 'bladebit*-ubuntu-arm64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"

View File

@ -116,58 +116,38 @@ jobs:
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot_k34
- name: Get latest bladebit plotter for Full Release
if: "github.event.release && !github.event.release.prerelease"
- name: Fetch bladebit versions
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
# Fetch the latest version of each type
LATEST_RELEASE=$(gh api repos/Chia-Network/bladebit/releases/latest --jq 'select(.prerelease == false) | .tag_name')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_RELEASE" -p 'bladebit*-ubuntu-x86-64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest beta bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'beta'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BETA=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-beta[0-9]+$"))) | first | .tag_name')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_BETA" -p 'bladebit*-ubuntu-x86-64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest RC bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'rc'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
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')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_RC" -p 'bladebit*-ubuntu-x86-64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest bladebit plotter for Dev
if: "!github.event.release"
# Compare the versions and choose the newest that matches the requirements
if [[ "$TAG_TYPE" == "beta" || -z "${{ github.event.release.tag_name }}" ]]; 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
# For RC builds, use the latest RC or full release if it's newer
LATEST_VERSION=$(printf "%s\n%s\n" "$LATEST_RELEASE" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1)
else
# For full releases, use the latest full release
LATEST_VERSION="$LATEST_RELEASE"
fi
echo "LATEST_VERSION=$LATEST_VERSION" >> "$GITHUB_ENV"
- name: Get latest bladebit plotter
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BLADEBIT=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease and (.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-(beta|rc)[0-9]+$")))) | first | .tag_name')
# Download and extract the chosen version
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_BLADEBIT" -p 'bladebit*-ubuntu-x86-64.tar.gz'
gh release download -R Chia-Network/bladebit "$LATEST_VERSION" -p 'bladebit*-ubuntu-x86-64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"

View File

@ -115,58 +115,38 @@ jobs:
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot_k34
- name: Get latest bladebit plotter for Full Release
if: "github.event.release && !github.event.release.prerelease"
- name: Fetch bladebit versions
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
# Fetch the latest version of each type
LATEST_RELEASE=$(gh api repos/Chia-Network/bladebit/releases/latest --jq 'select(.prerelease == false) | .tag_name')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_RELEASE" -p 'bladebit*-centos-x86-64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest beta bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'beta'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BETA=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-beta[0-9]+$"))) | first | .tag_name')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_BETA" -p 'bladebit*-centos-x86-64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest RC bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'rc'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
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')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_RC" -p 'bladebit*-centos-x86-64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest bladebit plotter for Dev
if: "!github.event.release"
# Compare the versions and choose the newest that matches the requirements
if [[ "$TAG_TYPE" == "beta" || -z "${{ github.event.release.tag_name }}" ]]; 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
# For RC builds, use the latest RC or full release if it's newer
LATEST_VERSION=$(printf "%s\n%s\n" "$LATEST_RELEASE" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1)
else
# For full releases, use the latest full release
LATEST_VERSION="$LATEST_RELEASE"
fi
echo "LATEST_VERSION=$LATEST_VERSION" >> "$GITHUB_ENV"
- name: Get latest bladebit plotter
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BLADEBIT=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease and (.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-(beta|rc)[0-9]+$")))) | first | .tag_name')
# Download and extract the chosen version
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
gh release download -R Chia-Network/bladebit "$LATEST_BLADEBIT" -p 'bladebit*-centos-x86-64.tar.gz'
gh release download -R Chia-Network/bladebit "$LATEST_VERSION" -p 'bladebit*-centos-x86-64.tar.gz'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"

View File

@ -150,74 +150,42 @@ jobs:
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot
chmod +x "$GITHUB_WORKSPACE"/madmax/chia_plot_k34
- name: Get latest bladebit plotter for Full Release
if: "github.event.release && !github.event.release.prerelease"
- name: Fetch bladebit versions
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
# Fetch the latest version of each type
LATEST_RELEASE=$(gh api repos/Chia-Network/bladebit/releases/latest --jq 'select(.prerelease == false) | .tag_name')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
ASSETS=$(gh release view "$LATEST_RELEASE" --repo Chia-Network/bladebit --json assets -q '.assets[].name')
if ! echo "$ASSETS" | grep -q 'bladebit.*-${{ matrix.os.bladebit-suffix }}'; then
LATEST_RELEASE=v2.0.1
fi
gh release download -R Chia-Network/bladebit "$LATEST_RELEASE" -p 'bladebit*-${{ matrix.os.bladebit-suffix }}'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest beta bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'beta'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BETA=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-beta[0-9]+$"))) | first | .tag_name')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
ASSETS=$(gh release view "$LATEST_BETA" --repo Chia-Network/bladebit --json assets -q '.assets[].name')
if ! echo "$ASSETS" | grep -q 'bladebit.*-${{ matrix.os.bladebit-suffix }}'; then
LATEST_BETA=v2.0.1
fi
gh release download -R Chia-Network/bladebit "$LATEST_BETA" -p 'bladebit*-${{ matrix.os.bladebit-suffix }}'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest RC bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'rc'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
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')
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
ASSETS=$(gh release view "$LATEST_RC" --repo Chia-Network/bladebit --json assets -q '.assets[].name')
if ! echo "$ASSETS" | grep -q 'bladebit.*-${{ matrix.os.bladebit-suffix }}'; then
LATEST_RC=v2.0.1
fi
gh release download -R Chia-Network/bladebit "$LATEST_RC" -p 'bladebit*-${{ matrix.os.bladebit-suffix }}'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"
- name: Get latest bladebit plotter for Dev
if: "!github.event.release"
# Compare the versions and choose the newest that matches the requirements
if [[ "$TAG_TYPE" == "beta" || -z "${{ github.event.release.tag_name }}" ]]; 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
# For RC builds, use the latest RC or full release if it's newer
LATEST_VERSION=$(printf "%s\n%s\n" "$LATEST_RELEASE" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1)
else
# For full releases, use the latest full release
LATEST_VERSION="$LATEST_RELEASE"
fi
echo "LATEST_VERSION=$LATEST_VERSION" >> "$GITHUB_ENV"
- name: Get latest bladebit plotter
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BLADEBIT=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease and (.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-(beta|rc)[0-9]+$")))) | first | .tag_name')
# Download and extract the chosen version
mkdir "$GITHUB_WORKSPACE"/bladebit
cd "$GITHUB_WORKSPACE"/bladebit
ASSETS=$(gh release view "$LATEST_BLADEBIT" --repo Chia-Network/bladebit --json assets -q '.assets[].name')
if ! echo "$ASSETS" | grep -q 'bladebit.*-${{ matrix.os.bladebit-suffix }}'; then
LATEST_BLADEBIT=v2.0.1
fi
gh release download -R Chia-Network/bladebit "$LATEST_BLADEBIT" -p 'bladebit*-${{ matrix.os.bladebit-suffix }}'
ASSETS=$(gh release view "$LATEST_VERSION" --repo Chia-Network/bladebit --json assets -q '.assets[].name')
if ! echo "$ASSETS" | grep -q 'bladebit.*-${{ matrix.os.bladebit-suffix }}'; then
LATEST_VERSION=v2.0.1
fi
gh release download -R Chia-Network/bladebit "$LATEST_VERSION" -p 'bladebit*-${{ matrix.os.bladebit-suffix }}'
ls *.tar.gz | xargs -I{} bash -c 'tar -xzf {} && rm {}'
ls bladebit* | xargs -I{} chmod +x {}
cd "$OLDPWD"

View File

@ -160,55 +160,38 @@ jobs:
gh release download -R Chia-Network/chia-plotter-madmax "$LATEST_MADMAX" -p 'chia_plot-*.exe' -O "$GITHUB_WORKSPACE"\\madmax\\chia_plot.exe
gh release download -R Chia-Network/chia-plotter-madmax "$LATEST_MADMAX" -p 'chia_plot_k34-*.exe' -O "$GITHUB_WORKSPACE"\\madmax\\chia_plot_k34.exe
- name: Get latest bladebit plotter for Full Release
if: "github.event.release && !github.event.release.prerelease"
- name: Fetch bladebit versions
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
# Fetch the latest version of each type
LATEST_RELEASE=$(gh api repos/Chia-Network/bladebit/releases/latest --jq 'select(.prerelease == false) | .tag_name')
mkdir "$GITHUB_WORKSPACE\\bladebit"
cd "$GITHUB_WORKSPACE\\bladebit"
gh release download -R Chia-Network/bladebit "$LATEST_RELEASE" -p 'bladebit*windows-x86-64.zip'
ls *.zip | xargs -I{} bash -c 'unzip {} && rm {}'
cd "$OLDPWD"
- name: Get latest beta bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'beta'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BETA=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease) | select(.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-beta[0-9]+$"))) | first | .tag_name')
mkdir "$GITHUB_WORKSPACE\\bladebit"
cd "$GITHUB_WORKSPACE\\bladebit"
gh release download -R Chia-Network/bladebit "$LATEST_BETA" -p 'bladebit*windows-x86-64.zip'
ls *.zip | xargs -I{} bash -c 'unzip {} && rm {}'
cd "$OLDPWD"
- name: Get latest RC bladebit plotter
if: "github.event.release && github.event.release.prerelease || env.TAG_TYPE == 'rc'"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
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')
mkdir "$GITHUB_WORKSPACE\\bladebit"
cd "$GITHUB_WORKSPACE\\bladebit"
gh release download -R Chia-Network/bladebit "$LATEST_RC" -p 'bladebit*windows-x86-64.zip'
ls *.zip | xargs -I{} bash -c 'unzip {} && rm {}'
cd "$OLDPWD"
- name: Get latest bladebit plotter for Dev
if: "!github.event.release"
# Compare the versions and choose the newest that matches the requirements
if [[ "$TAG_TYPE" == "beta" || -z "${{ github.event.release.tag_name }}" ]]; 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
# For RC builds, use the latest RC or full release if it's newer
LATEST_VERSION=$(printf "%s\n%s\n" "$LATEST_RELEASE" "$LATEST_RC" | sed '/-/!s/$/_/' | sort -V | sed 's/_$//' | tail -n 1)
else
# For full releases, use the latest full release
LATEST_VERSION="$LATEST_RELEASE"
fi
echo "LATEST_VERSION=$LATEST_VERSION" >> "$GITHUB_ENV"
- name: Get latest bladebit plotter
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
LATEST_BLADEBIT=$(gh api repos/Chia-Network/bladebit/releases --jq 'map(select(.prerelease and (.tag_name | test("^v[0-9]+\\.[0-9]+\\.[0-9]+-(beta|rc)[0-9]+$")))) | first | .tag_name')
# Download and extract the chosen version
mkdir "$GITHUB_WORKSPACE\\bladebit"
cd "$GITHUB_WORKSPACE\\bladebit"
gh release download -R Chia-Network/bladebit "$LATEST_BLADEBIT" -p 'bladebit*windows-x86-64.zip'
gh release download -R Chia-Network/bladebit "$LATEST_VERSION" -p 'bladebit*windows-x86-64.zip'
ls *.zip | xargs -I{} bash -c 'unzip {} && rm {}'
cd "$OLDPWD"