Skip to content

Commit

Permalink
Do not support v prefix era anymore (#138)
Browse files Browse the repository at this point in the history
* Do not support v prefix era anymore

Closes #137

jdx/mise#1637

* `makers fmt`

* Remove needless logics

* Keep latest-stable again

* Add note why xrags

* Restrict CI referenced version

* Specify --force to mise, looks cache problem in CI

* Clarify to avoid flaky mise action cache logics
  • Loading branch information
kachick authored Mar 16, 2024
1 parent e23ac17 commit 6ddf01f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
tool-version:
- 'latest'
- 'r88' # Having newer "r" prefix instead of older "v", but not the latest(r89 or newer)
- 'v51' # Supporting oldest
- 'r75' # Supporting oldest. Because of v prefix does not work in mise https://github.com/jdx/mise/issues/1637
runs-on: ${{ matrix.os }}
steps:
- uses: asdf-vm/actions/plugin-test@v3
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/mise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,24 @@ jobs:
# Having newer "r" prefix instead of older "v", but not the latest(r89 or newer)
- command: mise x zigmod@r88 -- zigmod version
# Supporting oldest
- command: mise x zigmod@v51 -- zigmod version
- command: mise x zigmod@r75 -- zigmod version
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2
- uses: jdx/mise-action@3bc85396a273ed82bba5e53a15174bbf9dba095c # v2.0.2
with:
install: false
cache: false
tool_versions: |
# Should not set cargo-make versions here. (Actually shellcheck is not used here)
shellcheck 0.9.0
- name: Setup mise
run: |
mise plugins install zigmod https://github.com/kachick/asdf-zigmod.git#${{ github.ref }}
if [ '${{ github.event_name }}' = 'pull_request' ]; then
mise plugins install --force zigmod 'https://github.com/${{ github.repository }}.git#${{ github.event.pull_request.head.sha }}'
else
mise plugins install --force zigmod 'https://github.com/${{ github.repository }}.git#${{ github.sha }}'
fi
- name: Test
run: |
${{ matrix.target.command }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $ asdf list-all zigmod
$ asdf install zigmod latest

# NOTE:
# - This plugin supports zigmod versions v51 or later
# - This plugin supports zigmod versions r75 or later
# - r* is newer prefix than v*

# Set a version globally (on your ~/.tool-versions file)
Expand Down
2 changes: 1 addition & 1 deletion bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugin_dir=$(dirname "$(dirname "$current_script_path")")
source "${plugin_dir}/lib/utils.bash"

if ! is_supporting_zigmod_version; then
fail "Supporting zigmod versions are v51 or higher. But you specified '$ASDF_INSTALL_VERSION'"
fail "Supporting zigmod versions are r75 or higher. But you specified '$ASDF_INSTALL_VERSION'"
fi

mkdir -p "$ASDF_DOWNLOAD_PATH"
Expand Down
3 changes: 0 additions & 3 deletions bin/latest-stable
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ plugin_dir=$(dirname "$(dirname "$current_script_path")")
# shellcheck source=../lib/utils.bash
source "${plugin_dir}/lib/utils.bash"

# zigmod changed versioning prefix from "v*" to "r*"
# - Since r75. - https://github.com/nektro/zigmod/compare/v98...r75#diff-7618f5168e5222f8c0abc2df987536d51d98f2ef5e34958e08420a187ffc5613L7-R5
# - No reasons were written. - https://github.com/nektro/zigmod/commit/410c2e98a2c986885ce7677160b7212db69d223e
list_sorted_all_supporting_versions | tail -1
1 change: 1 addition & 0 deletions bin/list-all
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ source "${plugin_dir}/lib/utils.bash"
# Shows only this plugin supporting versions.
# https://github.com/asdf-vm/asdf/blob/950e4172719cde107e9dfc2c8c38d88ee0d000ca/docs/plugins/create.md?plain=1#L9
# https://github.com/asdf-vm/asdf/blob/950e4172719cde107e9dfc2c8c38d88ee0d000ca/docs/plugins/create.md?plain=1#L32
# Using xargs to make oneline overview, each version as line is not useful
list_sorted_all_supporting_versions | xargs echo
27 changes: 6 additions & 21 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ set -euo pipefail
GH_REPO="https://github.com/nektro/zigmod"
TOOL_NAME="zigmod"

# `version` exists since v51 https://github.com/nektro/zigmod/commit/ef20897b8196b4f3da3ee9bcc5ab731851d3aa2b
TOOL_TEST="zigmod version"

supporting_zigmod_version_pattern='^(r|v[6-9][0-9]|v5[1-9])'
supporting_zigmod_version_pattern='^r'

filter_supporting_zigmod_versions() {
grep -E "$supporting_zigmod_version_pattern"
Expand All @@ -29,17 +28,6 @@ if [ -n "${GITHUB_API_TOKEN:-}" ]; then
curl_opts=("${curl_opts[@]}" -H "Authorization: token $GITHUB_API_TOKEN")
fi

sort_supportable_zigmod_versions() {
local sortables
sortables="$(cat -)"

# zigmod changed versioning prefix from "v*" to "r*"
# - Since r75. - https://github.com/nektro/zigmod/compare/v98...r75#diff-7618f5168e5222f8c0abc2df987536d51d98f2ef5e34958e08420a187ffc5613L7-R5
# - No reasons were written. - https://github.com/nektro/zigmod/commit/410c2e98a2c986885ce7677160b7212db69d223e
echo "$sortables" | grep -E '^v'
echo "$sortables" | grep -E '^r'
}

list_github_tags() {
git ls-remote --tags --refs "$GH_REPO" |
grep -o 'refs/tags/.*' | cut -d/ -f3-
Expand All @@ -49,8 +37,9 @@ list_all_versions() {
list_github_tags
}

# We dropped to support v era since https://github.com/jdx/mise/issues/1637, no need to consider sort logics here
list_sorted_all_supporting_versions() {
list_all_versions | filter_supporting_zigmod_versions | sort_supportable_zigmod_versions
list_all_versions | filter_supporting_zigmod_versions
}

download_release() {
Expand Down Expand Up @@ -78,13 +67,9 @@ download_release() {
# - https://github.com/nektro/zigmod/releases/download/r83/zigmod-x86_64-linux
# Note
# - "zigmod" uploads non archived binary files to the GitHub releases.
# - "zigmod" changed versioning prefix from "v*" to "r*". See `../bin/latest-stable` for further detail
# - Earlier than v21 having different naming style for the assets
# - https://github.com/nektro/zigmod/releases/tag/r75
# - https://github.com/nektro/zigmod/releases/tag/v21 # Naming style is same. However doesn't have `version` command.
# - https://github.com/nektro/zigmod/releases/tag/v20-0ef0ceb # different
# - https://github.com/nektro/zigmod/releases/tag/v8-1993719 # more different
# - https://github.com/nektro/zigmod/releases/tag/v7-b0fd757 # much different!
# - "zigmod" changed versioning prefix from "v*" to "r*".
# - Since r75. - https://github.com/nektro/zigmod/compare/v98...r75#diff-7618f5168e5222f8c0abc2df987536d51d98f2ef5e34958e08420a187ffc5613L7-R5
# - No reasons were written. - https://github.com/nektro/zigmod/commit/410c2e98a2c986885ce7677160b7212db69d223e
local url="$GH_REPO/releases/download/${version}/zigmod-${architecture}-${platform}"

echo "* Downloading $TOOL_NAME release $version..."
Expand Down

0 comments on commit 6ddf01f

Please sign in to comment.