Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Commit 7f018de

Browse files
committed
Repackage binaries in .tar.gz format
1 parent 3632997 commit 7f018de

6 files changed

Lines changed: 95 additions & 34 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- name: Set up Docker Buildx
15+
uses: docker/setup-buildx-action@v2
16+
- name: Extract VERSION from tag
17+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
18+
- name: Build packages
19+
uses: docker/bake-action@v2
20+
- name: Create GitHub release
21+
uses: softprops/action-gh-release@v1
22+
with:
23+
files: dist/*
24+
fail_on_unmatched_files: true

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# syntax=docker/dockerfile:1
2+
3+
ARG VERSION
4+
5+
FROM --platform=darwin/arm64 ghcr.io/homebrew/core/shellcheck:${VERSION} AS darwin-arm64
6+
7+
FROM alpine AS archives
8+
9+
RUN apk add --no-cache curl bash xz
10+
11+
COPY scripts/download_and_archive.sh /scripts/download_and_archive.sh
12+
13+
ARG VERSION
14+
COPY --from=darwin-arm64 shellcheck/${VERSION}/bin/shellcheck /downloads/
15+
RUN /scripts/download_and_archive.sh
16+
17+
FROM scratch
18+
19+
COPY --from=archives /archives/ /

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
# shellcheck-m1
1+
# ShellCheck binaries for the VS Code extension
22

3-
Sync homebrew'ed Apple M1 shellcheck build.
3+
ShellCheck binaries distributed in `.tar.gz` format for Linux and macOS, including M1 Macs. Used by [ShellCheck VS Code extension](https://github.com/vscode-shellcheck/vscode-shellcheck).
4+
5+
## Why?
6+
7+
- ShellCheck doesn't officially provide binaries for M1 Macs.
8+
- ShellCheck ships binaries packaged in `.tar.xz` format, in which [`bindl`](https://github.com/felipecrs/bindl/issues/217) doesn't support.
9+
10+
## How to generate more binaries?
11+
12+
Simply push a new tag to this repository in the format `v*.*.*` matching the [ShellCheck version](https://github.com/koalaman/shellcheck/releases). The CI will generate binaries for all supported platforms and upload them to the release.

docker-bake.hcl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
variable "VERSION" {
2+
default = "0.0.0"
3+
}
4+
5+
target "default" {
6+
dockerfile = "Dockerfile"
7+
args = {
8+
VERSION = "${VERSION}"
9+
}
10+
output = ["./dist"]
11+
}

download.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

scripts/download_and_archive.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
function download_and_archive() {
4+
local os="${1}"
5+
local arch="${2}"
6+
rm -rf /downloads
7+
mkdir -p /downloads
8+
curl -fsSL \
9+
"https://github.com/koalaman/shellcheck/releases/download/v${VERSION}/shellcheck-v${VERSION}.${os}.${arch}.tar.xz" |
10+
tar --strip-components=1 -xJv -C /downloads "shellcheck-v${VERSION}/shellcheck"
11+
12+
archive "${os}" "${arch}"
13+
}
14+
15+
function archive() {
16+
local os="${1}"
17+
local arch="${2}"
18+
19+
mkdir -p /archives
20+
tar -cvzf "/archives/shellcheck-${VERSION}-${os}-${arch}.tar.gz" -C "/downloads" shellcheck
21+
}
22+
23+
set -euxo pipefail
24+
25+
archive "darwin" "arm64"
26+
download_and_archive "darwin" "x86_64"
27+
28+
download_and_archive "linux" "x86_64"
29+
download_and_archive "linux" "aarch64"
30+
download_and_archive "linux" "armv6hf"

0 commit comments

Comments
 (0)