Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ jobs:
steps:
- name: Get Go versions
id: versions
env:
GO_VERSION: ${{ vars.GO_VERSION }}
run: |
VERSIONS=$(
curl -s 'https://go.dev/dl/?mode=json' \
| jq -r '
[.[] | select(.stable) | .version]
| group_by(split(".")[0:2] | join("."))
| map(max_by(ltrimstr("go") | split(".") | map(tonumber)))[]
' | sed 's/go//'
)
VERSIONS_ARRAY=$(echo "$VERSIONS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
if [ -n "$GO_VERSION" ]; then
# Repository variable overrides the API — build only that version
VERSIONS_ARRAY=$(jq -cn --arg v "$GO_VERSION" '[$v]')
else
VERSIONS=$(
curl -s 'https://go.dev/dl/?mode=json' \
| jq -r '
[.[] | select(.stable) | .version]
| group_by(split(".")[0:2] | join("."))
| map(max_by(ltrimstr("go") | split(".") | map(tonumber)))[]
' | sed 's/go//'
)
VERSIONS_ARRAY=$(echo "$VERSIONS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
fi
echo "matrix={\"go-version\":$VERSIONS_ARRAY}" >> $GITHUB_OUTPUT

- name: Get latest version
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ WORKDIR /go

FROM ubuntu:24.04@sha256:d1e2e92c075e5ca139d51a140fff46f84315c0fdce203eab2807c7e495eff4f9

ARG GO_VERSION
LABEL org.opencontainers.image.version="${GO_VERSION}"

RUN set -eux && \
apt-get update && \
Expand All @@ -43,6 +45,7 @@ RUN set -eux && \
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
ENV CGO_ENABLED=0
ENV GO_VERSION=${GO_VERSION}

COPY --from=base /usr/local/go /usr/local/go

Expand Down
Loading