diff --git a/.github/workflows/functional-tests.yml b/.github/workflows/functional-tests.yml index 824a91d..e7865b3 100644 --- a/.github/workflows/functional-tests.yml +++ b/.github/workflows/functional-tests.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu", "macos"] - version: ["9.11.1", "9.11.0", "9.10.1", "9.10.0", "9.9.0"] + version: ["latest", "9.12.0", "9.11.1", "9.11.0", "9.10.1", "9.10.0"] runs-on: ${{ matrix.os }}-latest steps: - name: Checkout ${{ github.repository }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bf7394a..c8f85bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,7 +38,7 @@ repos: hooks: - id: prettier - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-merge-conflict - id: check-json diff --git a/action.yml b/action.yml index 4a9c1d2..3c51ef3 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,7 @@ inputs: version: description: "mark version." required: false - default: "9.11.1" + default: "latest" runs: using: "composite" steps: diff --git a/src/install-mark.sh b/src/install-mark.sh index b5e719d..e8fa0cc 100755 --- a/src/install-mark.sh +++ b/src/install-mark.sh @@ -9,18 +9,24 @@ if command -v mark >/dev/null 2>&1; then exit 0 fi +if [ "${mark_version}" = "latest" ]; then + url_prefix="https://github.com/kovetskiy/mark/releases/latest/download" +else + url_prefix="https://github.com/kovetskiy/mark/releases/download/${mark_version}" +fi + url="" if [ "${RUNNER_OS}" = "macOS" ]; then if [ "${RUNNER_ARCH}" = "X64" ]; then - url="https://github.com/kovetskiy/mark/releases/download/${mark_version}/mark_Darwin_x86_64.tar.gz" + url="${url_prefix}/mark_Darwin_x86_64.tar.gz" elif [ "${RUNNER_ARCH}" = "ARM64" ]; then - url="https://github.com/kovetskiy/mark/releases/download/${mark_version}/mark_Darwin_arm64.tar.gz" + url="${url_prefix}/mark_Darwin_arm64.tar.gz" fi elif [ "${RUNNER_OS}" = "Linux" ]; then if [ "${RUNNER_ARCH}" = "X64" ]; then - url="https://github.com/kovetskiy/mark/releases/download/${mark_version}/mark_Linux_x86_64.tar.gz" + url="${url_prefix}/mark_Linux_x86_64.tar.gz" elif [ "${RUNNER_ARCH}" = "ARM64" ]; then - url="https://github.com/kovetskiy/mark/releases/download/${mark_version}/mark_Linux_arm64.tar.gz" + url="${url_prefix}/mark_Linux_arm64.tar.gz" fi fi @@ -32,7 +38,15 @@ fi bin_path="${RUNNER_TEMP}/bin" mkdir -p "${bin_path}" tar_path="${bin_path}/mark.tar.gz" +checksums_path="${bin_path}/checksums.txt" curl -sL "${url}" -o "${tar_path}" +curl -sL "${url_prefix}/checksums.txt" -o "${checksums_path}" + +if ! grep -qF "$(shasum -a 256 "${tar_path}" | cut -d ' ' -f 1)" "${checksums_path}"; then + echo "::error title=Checksum error::Checksum is different from the downloaded binary" + exit 1 +fi + tar -xf "${tar_path}" -C "${bin_path}" rm -f "${tar_path}" echo "${bin_path}" >> "$GITHUB_PATH"