From c7e6976fa42ac3298e3983863349653f934aa9b4 Mon Sep 17 00:00:00 2001 From: Adam Fidel Date: Sun, 5 Jan 2025 19:23:38 -0600 Subject: [PATCH] fix(actions): try to recover if just fails to install (#81) * fix(actions): try to recover if just fails to install * use loop if JUST_VERSION is garbage * quoting vars to appease the lint gods --------- Co-authored-by: m2 <69128853+m2Giles@users.noreply.github.com> --- .github/workflows/generate-release.yml | 10 ++-------- .github/workflows/reusable-build-iso.yml | 8 +------- .github/workflows/reusable-build.yml | 8 +------- .github/workflows/shared/install-just.sh | 10 ++++++++++ 4 files changed, 14 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/shared/install-just.sh diff --git a/.github/workflows/generate-release.yml b/.github/workflows/generate-release.yml index 36cffc3..0058f85 100644 --- a/.github/workflows/generate-release.yml +++ b/.github/workflows/generate-release.yml @@ -36,14 +36,8 @@ jobs: - name: Install Just shell: bash - run: | - set -eoux pipefail - JUST_VERSION=$(curl -L https://api.github.com/repos/casey/just/releases/latest | jq -r '.tag_name') - curl -sSLO https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz - tar -zxvf just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz -C /tmp just - sudo mv /tmp/just /usr/local/bin/just - rm -f just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz - + run: bash .github/workflows/shared/install-just.sh + - name: Check Just Syntax shell: bash run: | diff --git a/.github/workflows/reusable-build-iso.yml b/.github/workflows/reusable-build-iso.yml index f7be6f0..5219a8e 100644 --- a/.github/workflows/reusable-build-iso.yml +++ b/.github/workflows/reusable-build-iso.yml @@ -39,13 +39,7 @@ jobs: - name: Install Just shell: bash - run: | - set -eoux pipefail - JUST_VERSION=$(curl -L https://api.github.com/repos/casey/just/releases/latest | jq -r '.tag_name') - curl -sSLO https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz - tar -zxvf just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz -C /tmp just - sudo mv /tmp/just /usr/local/bin/just - rm -f just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz + run: bash .github/workflows/shared/install-just.sh - name: Check Just Syntax shell: bash diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 6c03498..22c2f72 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -48,13 +48,7 @@ jobs: - name: Install Just shell: bash - run: | - set -eoux pipefail - JUST_VERSION=$(curl -L https://api.github.com/repos/casey/just/releases/latest | jq -r '.tag_name') - curl -sSLO https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz - tar -zxvf just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz -C /tmp just - sudo mv /tmp/just /usr/local/bin/just - rm -f just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz + run: bash .github/workflows/shared/install-just.sh - name: Check Just Syntax shell: bash diff --git a/.github/workflows/shared/install-just.sh b/.github/workflows/shared/install-just.sh new file mode 100644 index 0000000..32060e8 --- /dev/null +++ b/.github/workflows/shared/install-just.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -eoux pipefail +while [[ "${JUST_VERSION:-}" =~ null || -z "${JUST_VERSION:-}" ]] +do + JUST_VERSION=$(curl -L https://api.github.com/repos/casey/just/releases/latest | jq -r '.tag_name') +done +curl -sSLO https://github.com/casey/just/releases/download/"${JUST_VERSION}"/just-"${JUST_VERSION}"-x86_64-unknown-linux-musl.tar.gz +tar -zxvf just-"${JUST_VERSION}"-x86_64-unknown-linux-musl.tar.gz -C /tmp just +sudo mv /tmp/just /usr/local/bin/just +rm -f just-"${JUST_VERSION}"-x86_64-unknown-linux-musl.tar.gz