Skip to content

Commit

Permalink
.github, fetch-configlet: rename release assets (#705)
Browse files Browse the repository at this point in the history
Before this commit, the release assets were named like:

    configlet-linux-64bit.tgz
    configlet-mac-64bit.tgz
    configlet-windows-64bit.zip
    configlet_4.0.0-beta.7_checksums_sha256.txt

With this commit, the next release will have assets named:

    configlet_4.0.0-beta.8_checksums_sha256.txt
    configlet_4.0.0-beta.8_linux_x86-64.tar.gz
    configlet_4.0.0-beta.8_macos_x86-64.tar.gz
    configlet_4.0.0-beta.8_windows_x86-64.zip

Where we:

- Make the archive naming format match that of the checksums file
- Add a version string
- Delimit with an underscore, not a hyphen
- Rename `64bit` to `x86-64`
- Rename `32bit` to `i386`
- Rename `tgz` to `tar.gz`
- Rename `mac` to `macos`

So far, we have only released configlet for x86-64, and the release
assets have always had an ambiguous `64bit` in the names. This naming
format was old (added by d4c6e26, 2020-10-09), and was ultimately
inherited from:

- the `exercism/configlet-v2` releases [1]
- the `exercism/cli` releases [2][3]

However, we're getting closer to adding releases for other 64-bit
architectures, so it's especially important to change the names now.

The rationale for the particular use of underscores and hyphens is:

- We want to have the version string in the asset filenames

- Configlet uses version strings that are compatible with the Semantic
  Versioning spec

- It is more common to use hyphens in executable names than
  underscores

- The Semantic Versioning spec forbids using an underscore, and
  specifies that prerelease versions can use hyphens [4]:

      Section 9:

      A pre-release version MAY be denoted by appending a hyphen and a
      series of dot separated identifiers immediately following the patch
      version. Identifiers MUST comprise only ASCII alphanumerics and
      hyphens [0-9A-Za-z-].
      [...]
      Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92

That is, there's an argument for the format of:

    some-app_1.0.0-beta.1_linux_x86-64.tar.gz

rather than:

    some_app-1.0.0-beta.1-linux-x86_64.tar.gz

because `_` fully separates the components of the first, and `-` does
not separate the components of the second (due to the `-beta` part of
the version string). This does ignore the convention of `_` as an
inter-word space, however.

[1] https://github.com/exercism/v2-configlet/releases
[2] exercism/cli#700 (comment)
[3] https://github.com/exercism/cli/releases/tag/v3.0.12
[4] https://semver.org/

Closes: #363
Refs: #24
  • Loading branch information
ee7 authored Nov 11, 2022
1 parent 8907279 commit 57e6c5f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
7 changes: 4 additions & 3 deletions .github/bin/create-artifact
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ artifacts_dir='artifacts'
mkdir -p "${artifacts_dir}"

binary_name='configlet'
build_tag="${GITHUB_REF_NAME}"

case "${OS}" in
windows)
artifact_file="${artifacts_dir}/${binary_name}-${OS}-${ARCH}.zip"
artifact_file="${artifacts_dir}/${binary_name}_${build_tag}_${OS}_${ARCH}.zip"
7z a "${artifact_file}" "${binary_name}.exe"
;;
linux | mac)
artifact_file="${artifacts_dir}/${binary_name}-${OS}-${ARCH}.tgz"
linux | macos)
artifact_file="${artifacts_dir}/${binary_name}_${build_tag}_${OS}_${ARCH}.tar.gz"
tar -cvzf "${artifact_file}" "${binary_name}"
;;
esac
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
include:
- os: linux
runs-on: ubuntu-22.04
arch: 64bit
arch: x86-64

- os: mac
- os: macos
runs-on: macos-12
arch: 64bit
arch: x86-64

- os: windows
runs-on: windows-2022
arch: 64bit
arch: x86-64

name: "${{ matrix.os }}-${{ matrix.arch }}"
runs-on: ${{ matrix.runs-on }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fetch-configlet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- os: linux
runs-on: ubuntu-22.04

- os: mac
- os: macos
runs-on: macos-12

- os: windows
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
include:
- os: linux
runs-on: ubuntu-22.04
arch: 64bit
arch: x86-64

- os: mac
- os: macos
runs-on: macos-12
arch: 64bit
arch: x86-64

- os: windows
runs-on: windows-2022
arch: 64bit
arch: x86-64

name: "${{ matrix.os }}-${{ matrix.arch }}"
runs-on: ${{ matrix.runs-on }}
Expand Down
16 changes: 8 additions & 8 deletions scripts/fetch-configlet
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ get_download_url() {
local latest='https://api.github.com/repos/exercism/configlet/releases/latest'
local arch
case "$(uname -m)" in
*64*) arch='64bit' ;;
*686*) arch='32bit' ;;
*386*) arch='32bit' ;;
*) arch='64bit' ;;
x86_64) arch='x86-64' ;;
*686*) arch='i386' ;;
*386*) arch='i386' ;;
*) arch='x86-64' ;;
esac
local suffix="${os}-${arch}.${ext}"
local suffix="${os}_${arch}.${ext}"
curl "${curlopts[@]}" --header 'Accept: application/vnd.github.v3+json' "${latest}" |
grep "\"browser_download_url\": \".*/download/.*/configlet.*${suffix}\"$" |
cut -d'"' -f4
Expand All @@ -48,7 +48,7 @@ main() {

local os
case "$(uname)" in
Darwin*) os='mac' ;;
Darwin*) os='macos' ;;
Linux*) os='linux' ;;
Windows*) os='windows' ;;
MINGW*) os='windows' ;;
Expand All @@ -58,8 +58,8 @@ main() {

local ext
case "${os}" in
windows*) ext='zip' ;;
*) ext='tgz' ;;
windows*) ext='zip' ;;
*) ext='tar.gz' ;;
esac

echo "Fetching configlet..." >&2
Expand Down
4 changes: 2 additions & 2 deletions scripts/fetch-configlet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ $requestOpts = @{
RetryIntervalSec = 1
}

$arch = If ([Environment]::Is64BitOperatingSystem) { "64bit" } Else { "32bit" }
$fileName = "configlet-windows-$arch.zip"
$arch = If ([Environment]::Is64BitOperatingSystem) { "x86-64" } Else { "i386" }
$fileName = "configlet_.+_windows_$arch.zip"

Function Get-DownloadUrl {
$latestUrl = "https://api.github.com/repos/exercism/configlet/releases/latest"
Expand Down

1 comment on commit 57e6c5f

@ee7
Copy link
Member Author

@ee7 ee7 commented on 57e6c5f Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the commit message:

This does ignore the convention of _ as an inter-word space, however.

I meant "intra-word space".

Please sign in to comment.