main Dockerfile.release
Eric Bower  ·  2026-05-26
 1# Dockerfile for publishing GitHub releases
 2
 3FROM alpine:3.23
 4
 5RUN apk add --no-cache curl bash git
 6
 7ARG GH_VERSION=2.67.0
 8RUN curl -L -o /tmp/gh.tar.gz \
 9    https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz && \
10    cd /tmp && \
11    tar -xzf gh.tar.gz && \
12    cp gh_${GH_VERSION}_linux_amd64/bin/gh /usr/local/bin/gh && \
13    chmod +x /usr/local/bin/gh && \
14    rm -rf /tmp/gh*
15
16ARG TAG
17ENV GH_REPO="neurosnap/zmx"
18
19CMD ["sh", "-c", "test -n \"$TAG\" || { echo 'ERROR: TAG is required'; exit 1; }; \
20      VERSION=\"${TAG#v}\"; \
21      for f in /dist/*; do echo \"$f\" | grep -q \"zmx-$VERSION-\" || { echo \"ERROR: $f does not match $TAG\"; exit 1; }; done; \
22      gh release delete \"$TAG\" --repo \"$GH_REPO\" --yes 2>/dev/null; \
23      gh release create \"$TAG\" --repo \"$GH_REPO\" --title \"zmx $TAG\"; \
24      gh release upload \"$TAG\" /dist/* --repo \"$GH_REPO\" --clobber"]