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

Commit 4fcb9ad

Browse files
authored
Always build all versions (#9)
1 parent 2748254 commit 4fcb9ad

6 files changed

Lines changed: 60 additions & 91 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: ci
33
on:
44
push:
55
branches: [main]
6-
tags: ['v*.*.*']
76
pull_request:
87
branches: [main]
98

@@ -31,21 +30,35 @@ jobs:
3130

3231
release:
3332
runs-on: ubuntu-latest
34-
needs: check
35-
if: needs.check.result == 'success' && startsWith(github.ref, 'refs/tags/')
33+
needs: [check]
34+
if: github.event_name == 'push'
35+
permissions:
36+
contents: write
37+
strategy:
38+
matrix:
39+
include:
40+
- version: '0.9.0'
41+
homebrew-version: '0.9.0'
42+
- version: '0.8.0'
43+
homebrew-version: '0.8.0'
44+
- version: '0.7.2'
45+
homebrew-version: '0.7.2-1'
46+
fail-fast: false
3647
steps:
48+
- name: Set environment variables
49+
run: |
50+
echo "VERSION=${{ matrix.version }}" >> $GITHUB_ENV
51+
echo "HOMEBREW_VERSION=${{ matrix.homebrew-version }}" >> $GITHUB_ENV
52+
echo "TAG=v${{ matrix.version }}" >> $GITHUB_ENV
3753
- name: Checkout
3854
uses: actions/checkout@v3
3955
with:
4056
fetch-depth: 0
4157
- name: Set up Docker Buildx
4258
uses: docker/setup-buildx-action@v2
43-
- name: Extract VERSION from tag
44-
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
4559
- name: Build packages
4660
uses: docker/bake-action@v2
4761
- name: Create GitHub release
48-
uses: softprops/action-gh-release@v1
49-
with:
50-
files: dist/*
51-
fail_on_unmatched_files: true
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: scripts/create_release.sh

.github/workflows/new.yaml

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

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
# ================
66
# ShellCheck version
77
ARG VERSION
8+
ARG HOMEBREW_VERSION
89

910
# ================
1011
# DARWIN ARM64
1112
# ================
12-
FROM --platform=darwin/arm64 ghcr.io/homebrew/core/shellcheck:$VERSION AS darwin-arm64
13+
FROM --platform=darwin/arm64 ghcr.io/homebrew/core/shellcheck:$HOMEBREW_VERSION AS darwin-arm64
1314

1415
# ================
1516
# ARCHIVES
1617
# ================
1718
FROM alpine AS archives
18-
ARG VERSION
1919

2020
# Install packages
2121
RUN apk add --no-cache \
@@ -25,6 +25,8 @@ RUN apk add --no-cache \
2525
unzip \
2626
xz
2727

28+
ARG VERSION
29+
2830
# Copy Darwin arm64 binary
2931
COPY --from=darwin-arm64 shellcheck/$VERSION/bin/shellcheck /shellcheck.darwin.arm64.data/
3032

docker-bake.hcl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
variable "VERSION" {
2-
default = "0.0.0"
1+
variable "VERSION" {}
2+
3+
variable "HOMEBREW_VERSION" {
4+
default = "${VERSION}"
35
}
46

57
target "default" {
6-
dockerfile = "Dockerfile"
7-
args = {
8-
VERSION = "${VERSION}"
9-
}
10-
output = ["./dist"]
8+
dockerfile = "Dockerfile"
9+
args = {
10+
VERSION = "${VERSION}"
11+
HOMEBREW_VERSION = "${HOMEBREW_VERSION}"
12+
}
13+
output = ["./dist"]
1114
}

scripts/create_release.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# Fail on error
4+
set -o errexit
5+
# Fail on pipeline
6+
set -o pipefail
7+
# Disable undefined variable reference
8+
set -o nounset
9+
10+
TAG="${TAG?}"
11+
12+
# First delete if release is there already
13+
# https://github.com/cli/cli/issues/6964
14+
output=$(gh release delete "${TAG}" --cleanup-tag --yes 2>&1) || [[ "${output}" == "release not found" ]]
15+
echo "${output}"
16+
17+
# It would be nice if we could unmark the release as latest, but it
18+
# does not seem to be possible currently:
19+
# https://github.com/cli/cli/issues/6963
20+
gh release create "${TAG}" --title "${TAG}" --target main \
21+
--notes "The original release notes can be found [here](https://github.com/koalaman/shellcheck/releases/tag/${TAG})." \
22+
dist/*

scripts/download_and_archive.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ archive() {
163163
setup_system
164164

165165
# Darwin
166-
archive "$DARWIN_ARM64_DIR" "darwin" "arm64"
166+
archive "$DARWIN_ARM64_DIR" "darwin" "aarch64"
167167
download_and_archive "darwin" "x86_64"
168168

169169
# Linux
@@ -172,5 +172,5 @@ archive() {
172172
download_and_archive "linux" "armv6hf"
173173

174174
# Windows
175-
download_and_archive "windows" "x86"
175+
download_and_archive "windows" "x86_64"
176176
}

0 commit comments

Comments
 (0)