Skip to content

Commit

Permalink
feat: add script to automate sha256sum updates for mise defined tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Okeanos committed Jan 20, 2025
1 parent 610da42 commit a4b59ea
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/mise-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

## mise-update: Update .mise.toml so GitHub Actions have correct checksums available

# shellcheck disable=SC2034
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)

target=$(mktemp -d)

EDITORCONFIG_CHECKER_VERSION=$(grep -F 'editorconfig-checker' "${script_dir}/../.mise.toml" | cut -d '=' -f2 | cut -d '#' -f1 | xargs)
EDITORCONFIG_CHECKER_SHASUM_OLD=$(grep -F 'editorconfig-checker' "${script_dir}/../.mise.toml" | cut -d '=' -f3 | xargs)
curl --fail --silent --show-error --location --output "${target}/editorconfig.tar.gz" \
"https://github.com/editorconfig-checker/editorconfig-checker/releases/download/v${EDITORCONFIG_CHECKER_VERSION}/ec-linux-amd64.tar.gz"
EDITORCONFIG_CHECKER_SHASUM_NEW=$(sha256sum "${target}/editorconfig.tar.gz" | cut -d' ' -f1)
sed -i "s/${EDITORCONFIG_CHECKER_SHASUM_OLD}/${EDITORCONFIG_CHECKER_SHASUM_NEW}/" "${script_dir}/../.mise.toml"

GITLEAKS_VERSION=$(grep -F 'gitleaks' "${script_dir}/../.mise.toml" | cut -d '=' -f2 | cut -d '#' -f1 | xargs)
GITLEAKS_SHASUM_OLD=$(grep -F 'gitleaks' "${script_dir}/../.mise.toml" | cut -d '=' -f3 | xargs)
curl --fail --silent --show-error --location --output "${target}/gitleaks.tar.gz" \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
GITLEAKS_SHASUM_NEW=$(sha256sum "${target}/gitleaks.tar.gz" | cut -d' ' -f1)
sed -i "s/${GITLEAKS_SHASUM_OLD}/${GITLEAKS_SHASUM_NEW}/" "${script_dir}/../.mise.toml"

TAPLO_VERSION=$(grep -F 'taplo' "${script_dir}/../.mise.toml" | grep -v 'asdf' | cut -d '=' -f2 | cut -d '#' -f1 | xargs)
TAPLO_SHASUM_OLD=$(grep -F 'taplo' "${script_dir}/../.mise.toml" | cut -d '=' -f3 | xargs)
curl --fail --silent --show-error --location --output "${target}/taplo.gz" \
"https://github.com/tamasfe/taplo/releases/download/${TAPLO_VERSION}/taplo-full-linux-x86_64.gz"
TAPLO_SHASUM_NEW=$(sha256sum "${target}/taplo.gz" | cut -d' ' -f1)
sed -i "s/${TAPLO_SHASUM_OLD}/${TAPLO_SHASUM_NEW}/" "${script_dir}/../.mise.toml"

0 comments on commit a4b59ea

Please sign in to comment.