Compare commits
No commits in common. "main" and "v1" have entirely different histories.
2
.github/workflows/functional-tests.yml
vendored
2
.github/workflows/functional-tests.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: ["ubuntu", "macos"]
|
os: ["ubuntu", "macos"]
|
||||||
version: ["latest", "11.2.0", "11.1.0", "11.0.1", "11.0.0", "10.0.1"]
|
version: ["latest", "9.13.0", "9.12.0", "9.11.1", "9.11.0", "9.10.1"]
|
||||||
runs-on: ${{ matrix.os }}-latest
|
runs-on: ${{ matrix.os }}-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout ${{ github.repository }}
|
- name: Checkout ${{ github.repository }}
|
||||||
|
@ -3,18 +3,6 @@ default_install_hook_types: ["pre-commit", "pre-push"]
|
|||||||
default_stages: ["commit"]
|
default_stages: ["commit"]
|
||||||
minimum_pre_commit_version: 2.18.0
|
minimum_pre_commit_version: 2.18.0
|
||||||
repos:
|
repos:
|
||||||
# Linting
|
|
||||||
- repo: local
|
|
||||||
hooks:
|
|
||||||
- id: prettier
|
|
||||||
name: Prettier
|
|
||||||
entry: prettier --write --ignore-unknown
|
|
||||||
language: node
|
|
||||||
types: [text]
|
|
||||||
args: []
|
|
||||||
# https://github.com/prettier/prettier/releases
|
|
||||||
additional_dependencies: ["prettier@3.3.3"]
|
|
||||||
stages: ["commit"]
|
|
||||||
# Security
|
# Security
|
||||||
- repo: https://github.com/Yelp/detect-secrets
|
- repo: https://github.com/Yelp/detect-secrets
|
||||||
rev: v1.5.0
|
rev: v1.5.0
|
||||||
@ -22,12 +10,12 @@ repos:
|
|||||||
- id: detect-secrets
|
- id: detect-secrets
|
||||||
stages: ["commit", "push"]
|
stages: ["commit", "push"]
|
||||||
- repo: https://github.com/gitleaks/gitleaks
|
- repo: https://github.com/gitleaks/gitleaks
|
||||||
rev: v8.21.0
|
rev: v8.18.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: gitleaks
|
- id: gitleaks
|
||||||
stages: ["commit", "push"]
|
stages: ["commit", "push"]
|
||||||
- repo: https://github.com/fabasoad/pre-commit-grype
|
- repo: https://github.com/fabasoad/pre-commit-grype
|
||||||
rev: v0.6.1
|
rev: v0.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: grype-dir
|
- id: grype-dir
|
||||||
args:
|
args:
|
||||||
@ -36,7 +24,7 @@ repos:
|
|||||||
stages: ["push"]
|
stages: ["push"]
|
||||||
# Markdown
|
# Markdown
|
||||||
- repo: https://github.com/igorshubovych/markdownlint-cli
|
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||||
rev: v0.42.0
|
rev: v0.41.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: markdownlint-fix
|
- id: markdownlint-fix
|
||||||
# Shell
|
# Shell
|
||||||
@ -54,14 +42,18 @@ repos:
|
|||||||
stages: ["push"]
|
stages: ["push"]
|
||||||
# GitHub Actions
|
# GitHub Actions
|
||||||
- repo: https://github.com/rhysd/actionlint
|
- repo: https://github.com/rhysd/actionlint
|
||||||
rev: v1.7.3
|
rev: v1.7.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: actionlint
|
- id: actionlint
|
||||||
args: ["-pyflakes="]
|
args: ["-pyflakes="]
|
||||||
stages: ["commit"]
|
stages: ["commit"]
|
||||||
# Other
|
# Other
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: v3.1.0
|
||||||
|
hooks:
|
||||||
|
- id: prettier
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v5.0.0
|
rev: v4.6.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-executables-have-shebangs
|
- id: check-executables-have-shebangs
|
||||||
stages: ["commit"]
|
stages: ["commit"]
|
||||||
|
@ -24,7 +24,7 @@ action:
|
|||||||
- uses: fabasoad/setup-mark-action@v1
|
- uses: fabasoad/setup-mark-action@v1
|
||||||
with:
|
with:
|
||||||
# (Optional) mark version. Defaults to "latest".
|
# (Optional) mark version. Defaults to "latest".
|
||||||
version: "11.2.0"
|
version: "9.11.1"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
13
action.yml
13
action.yml
@ -10,23 +10,12 @@ inputs:
|
|||||||
description: "mark version."
|
description: "mark version."
|
||||||
required: false
|
required: false
|
||||||
default: "latest"
|
default: "latest"
|
||||||
url_prefix:
|
|
||||||
description: "mark url."
|
|
||||||
required: false
|
|
||||||
default: "https://github.com/kovetskiy/mark"
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Validate inputs
|
|
||||||
env:
|
|
||||||
INPUT_VERSION: "${{ inputs.version }}"
|
|
||||||
run: ./validate-inputs.sh "${INPUT_VERSION}"
|
|
||||||
shell: sh
|
|
||||||
working-directory: ${{ github.action_path }}/src
|
|
||||||
- name: Install kovetskiy/mark
|
- name: Install kovetskiy/mark
|
||||||
env:
|
env:
|
||||||
INPUT_VERSION: "${{ inputs.version }}"
|
INPUT_VERSION: "${{ inputs.version }}"
|
||||||
INPUT_URL_PREFIX: "${{ inputs.url_prefix }}"
|
run: ./install-mark.sh "${INPUT_VERSION}"
|
||||||
run: ./install-mark.sh "${INPUT_VERSION}" "${INPUT_URL_PREFIX}"
|
|
||||||
shell: sh
|
shell: sh
|
||||||
working-directory: ${{ github.action_path }}/src
|
working-directory: ${{ github.action_path }}/src
|
||||||
|
@ -1,58 +1,52 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
main() {
|
mark_version="$1"
|
||||||
mark_version="${1}"
|
|
||||||
url_prefix="${2}"
|
|
||||||
|
|
||||||
# shellcheck disable=SC2039
|
# shellcheck disable=SC2039
|
||||||
if command -v mark >/dev/null 2>&1; then
|
if command -v mark >/dev/null 2>&1; then
|
||||||
msg="$(mark --version) is already installed. Skipping installation."
|
msg="$(mark --version) is already installed. Skipping installation."
|
||||||
printf "[info] [setup-mark-action] %s %s\n" "$(date +'%Y-%m-%d %T')" "${msg}"
|
printf "[setup-mark-action] %s level=info %s\n" "$(date +'%Y-%m-%d %T')" "${msg}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
url_prefix="${url_prefix}/releases"
|
if [ "${mark_version}" = "latest" ]; then
|
||||||
if [ "${mark_version}" = "latest" ]; then
|
url_prefix="https://github.com/kovetskiy/mark/releases/latest/download"
|
||||||
url_prefix="${url_prefix}/latest/download"
|
else
|
||||||
else
|
url_prefix="https://github.com/kovetskiy/mark/releases/download/${mark_version}"
|
||||||
url_prefix="${url_prefix}/download/${mark_version}"
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
url=""
|
url=""
|
||||||
if [ "${RUNNER_OS}" = "macOS" ]; then
|
if [ "${RUNNER_OS}" = "macOS" ]; then
|
||||||
if [ "${RUNNER_ARCH}" = "X64" ]; then
|
if [ "${RUNNER_ARCH}" = "X64" ]; then
|
||||||
url="${url_prefix}/mark_Darwin_x86_64.tar.gz"
|
url="${url_prefix}/mark_Darwin_x86_64.tar.gz"
|
||||||
elif [ "${RUNNER_ARCH}" = "ARM64" ]; then
|
elif [ "${RUNNER_ARCH}" = "ARM64" ]; then
|
||||||
url="${url_prefix}/mark_Darwin_arm64.tar.gz"
|
url="${url_prefix}/mark_Darwin_arm64.tar.gz"
|
||||||
fi
|
fi
|
||||||
elif [ "${RUNNER_OS}" = "Linux" ]; then
|
elif [ "${RUNNER_OS}" = "Linux" ]; then
|
||||||
if [ "${RUNNER_ARCH}" = "X64" ]; then
|
if [ "${RUNNER_ARCH}" = "X64" ]; then
|
||||||
url="${url_prefix}/mark_Linux_x86_64.tar.gz"
|
url="${url_prefix}/mark_Linux_x86_64.tar.gz"
|
||||||
elif [ "${RUNNER_ARCH}" = "ARM64" ]; then
|
elif [ "${RUNNER_ARCH}" = "ARM64" ]; then
|
||||||
url="${url_prefix}/mark_Linux_arm64.tar.gz"
|
url="${url_prefix}/mark_Linux_arm64.tar.gz"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${url}" ]; then
|
if [ -z "${url}" ]; then
|
||||||
echo "::error title=OS is not supported::${RUNNER_OS} ${RUNNER_ARCH} is not supported"
|
echo "::error title=OS is not supported::${RUNNER_OS} ${RUNNER_ARCH} is not supported"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bin_path="${RUNNER_TEMP}/bin"
|
bin_path="${RUNNER_TEMP}/bin"
|
||||||
mkdir -p "${bin_path}"
|
mkdir -p "${bin_path}"
|
||||||
tar_path="${bin_path}/mark.tar.gz"
|
tar_path="${bin_path}/mark.tar.gz"
|
||||||
checksums_path="${bin_path}/checksums.txt"
|
checksums_path="${bin_path}/checksums.txt"
|
||||||
curl -sL "${url}" -o "${tar_path}"
|
curl -sL "${url}" -o "${tar_path}"
|
||||||
curl -sL "${url_prefix}/checksums.txt" -o "${checksums_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
|
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"
|
echo "::error title=Checksum error::Checksum is different from the downloaded binary"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tar -xf "${tar_path}" -C "${bin_path}"
|
tar -xf "${tar_path}" -C "${bin_path}"
|
||||||
rm -f "${tar_path}"
|
rm -f "${tar_path}"
|
||||||
echo "${bin_path}" >> "$GITHUB_PATH"
|
echo "${bin_path}" >> "$GITHUB_PATH"
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
# Validates value to be a valid semver string.
|
|
||||||
# Parameters:
|
|
||||||
# 1. (Required) Param name to display it correctly in the error message for the
|
|
||||||
# users.
|
|
||||||
# 2. (Required) Param value that will be validated.
|
|
||||||
#
|
|
||||||
# Usage examples:
|
|
||||||
# check_semver "my-valid-semver-1" "1.2.3"
|
|
||||||
# check_semver "my-valid-semver-3" "latest"
|
|
||||||
# check_semver "my-invalid-semver" "1.2.3-rc1"
|
|
||||||
check_semver() {
|
|
||||||
if ! echo "${2}" | grep -Eq '^(latest|[0-9]+(\.[0-9]+){0,2})$'; then
|
|
||||||
msg="\"${1}\" parameter is invalid. \"${2}\" is not a valid semver."
|
|
||||||
echo "::error title=Invalid parameter::${msg}"
|
|
||||||
exit 30
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
input_version="${1}"
|
|
||||||
|
|
||||||
check_semver "version" "${input_version}"
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
Loading…
x
Reference in New Issue
Block a user