From 9294602a528a762d643c76c62e57df17948a9358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Mon, 5 May 2025 16:23:43 -0500 Subject: [PATCH 1/2] Allow usage of sha1sum for OS's that do not have sha256sum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- scripts/install_sh/install.sh.txt | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/install_sh/install.sh.txt b/scripts/install_sh/install.sh.txt index f3415ad..233610f 100644 --- a/scripts/install_sh/install.sh.txt +++ b/scripts/install_sh/install.sh.txt @@ -9,6 +9,20 @@ if test -z "$BASH_VERSION"; then exit 1 fi +# Function to check for required commands +check_command() { + command -v "$1" >/dev/null 2>&1 || { echo >&2 "Error: $1 is required but not installed."; exit 1; } +} + +# Check for required commands +check_command sha256sum || check_command sha1sum + +# Set checksum command based on availability +CHECKSUM_CMD=sha256sum +if ! command -v $CHECKSUM_CMD >/dev/null 2>&1; then + CHECKSUM_CMD=sha1sum +fi + install() { set -euo pipefail @@ -17,10 +31,11 @@ install() { if [ -x "$(command -v wget)" ]; then dl_bin="wget -nv -O-" else + check_command curl dl_bin="curl -s -L" fi - shasum -v 1>/dev/null 2>&1 || (echo "Missing shasum binary" && exit 1) + $CHECKSUM_CMD -v 1>/dev/null 2>&1 || (echo "Missing shasum binary" && exit 1) if [[ `uname` == Darwin ]]; then binary_type=darwin-amd64 @@ -37,7 +52,7 @@ install() { (@ for val in data.values.products: @) echo "Installing (@= val.product @)..." $dl_bin (@= addProtocol(val.github.url) @)/releases/download/(@= val.version @)/(@= val.product @)-${binary_type} > /tmp/(@= val.product @) - echo "${(@= val.product @)_checksum} /tmp/(@= val.product @)" | shasum -c - + echo "${(@= val.product @)_checksum} /tmp/(@= val.product @)" | $CHECKSUM_CMD -c - mv /tmp/(@= val.product @) ${dst_dir}/(@= val.product @) chmod +x ${dst_dir}/(@= val.product @) echo "Installed ${dst_dir}/(@= val.product @) (@= val.version @)" From 852936bd500eb5cbeaa899c63d951041b89e4678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pereira?= Date: Mon, 5 May 2025 17:24:47 -0500 Subject: [PATCH 2/2] Automated documentation release for new minor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Pereira --- .github/workflows/published_release.yml | 43 +++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.github/workflows/published_release.yml b/.github/workflows/published_release.yml index e3119a7..cc678a2 100644 --- a/.github/workflows/published_release.yml +++ b/.github/workflows/published_release.yml @@ -172,7 +172,50 @@ jobs: artifactName: homebrew-formula artifactPath: . + prepare-documentation-update: + runs-on: ubuntu-latest + needs: [process-release-information,update-releases-yaml] + if: endsWith(github.event.client_payload.tagName, '.0') + steps: + - name: Install ytt + uses: carvel-dev/setup-action@v1 + with: + only: ytt + token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout website + uses: actions/checkout@v4 + with: + fetch-depth: 0 + repository: 'github.com/carvel-dev/carvel' + path: website + - name: Run documentation update + run: | + pushd website/site + docVersion=`echo ${{ github.event.client_payload.tagName }} | awk -F. '{print $1"."$2".x"}'` + ./hack/release-doc.sh ${{ github.event.client_payload.toolName }} ${docVersion} + timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + + AUTHOR_EMAIL='carvel-bot@users.noreply.github.com' + AUTHOR_NAME='carvel-bot' + MESSAGE="chore: auto-update documentation for ${{ github.event.client_payload.toolName }} ${docVersion} ${timestamp}" + + remote_repo="git@github.com:${REPOSITORY}" + + tempkey=`basename $0` + TMP_DEPLOY_PRIV_KEY=`mktemp /tmp/${tempkey}.XXXXXX` || exit 1 + echo "${{ secrets.INSTALL_SH_DEPLOY_PRIVATE_KEY }}" > $TMP_DEPLOY_PRIV_KEY + eval $(ssh-agent -s) + ssh-add ${TMP_DEPLOY_PRIV_KEY} + + git config http.sslVerify true + git config --local user.email "${AUTHOR_EMAIL}" + git config --local user.name "${AUTHOR_NAME}" + + git add -A + + git commit -m "${MESSAGE}" $_EMPTY || exit 0 + git push "${remote_repo}" HEAD:develop --follow-tags; prepare-releases-file-for-install-sh: runs-on: ubuntu-latest needs: process-release-information