Skip to content

chore(release): 3.2.0 #40

chore(release): 3.2.0

chore(release): 3.2.0 #40

name: Publish Runtime Images
on:
workflow_dispatch:
inputs:
tag:
description: "Optional version tag (defaults to package.json version)"
required: false
include_latest:
description: "Also publish :latest"
required: false
default: "true"
push:
tags:
- "v*"
jobs:
publish:
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: "1.3.9"
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Blacksmith Builder
uses: useblacksmith/setup-docker-builder@v1
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve image tags
id: tags
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_TAG: ${{ github.event.inputs.tag }}
INPUT_INCLUDE_LATEST: ${{ github.event.inputs.include_latest }}
run: |
set -euo pipefail
if [ -n "${INPUT_TAG}" ]; then
VERSION="${INPUT_TAG#v}"
elif [ "${EVENT_NAME}" = "push" ] && [ "${GITHUB_REF_TYPE}" = "tag" ]; then
VERSION="${GITHUB_REF_NAME#v}"
else
VERSION="$(bun -e "const pkg = await Bun.file('package.json').json(); console.log(pkg.version)")"
fi
if [ -z "${VERSION}" ]; then
echo "Unable to resolve image version."
exit 1
fi
DOCKERHUB_IMAGE="docker.io/hackdance/hack"
GHCR_IMAGE="ghcr.io/${{ github.repository_owner }}/hack"
FULL_TAG_ARGS="--tag ${DOCKERHUB_IMAGE}:${VERSION} --tag ${GHCR_IMAGE}:${VERSION}"
SLIM_TAG_ARGS="--tag ${DOCKERHUB_IMAGE}:${VERSION}-slim --tag ${GHCR_IMAGE}:${VERSION}-slim"
if [ "${EVENT_NAME}" = "push" ] || [ "${INPUT_INCLUDE_LATEST}" = "true" ]; then
FULL_TAG_ARGS="${FULL_TAG_ARGS} --tag ${DOCKERHUB_IMAGE}:latest --tag ${GHCR_IMAGE}:latest"
SLIM_TAG_ARGS="${SLIM_TAG_ARGS} --tag ${DOCKERHUB_IMAGE}:slim --tag ${GHCR_IMAGE}:slim"
fi
{
echo "version=${VERSION}"
echo "dockerhub_image=${DOCKERHUB_IMAGE}"
echo "ghcr_image=${GHCR_IMAGE}"
echo "full_tag_args=${FULL_TAG_ARGS}"
echo "slim_tag_args=${SLIM_TAG_ARGS}"
} >> "$GITHUB_OUTPUT"
- name: Build and push full runtime image
run: |
bun run scripts/build-node-runtime-image.ts \
--variant node-runtime \
--push \
--platform linux/amd64,linux/arm64 \
${{ steps.tags.outputs.full_tag_args }}
- name: Build and push slim runtime image
run: |
bun run scripts/build-node-runtime-image.ts \
--variant slim \
--push \
--platform linux/amd64,linux/arm64 \
${{ steps.tags.outputs.slim_tag_args }}
- name: Summary
run: |
{
echo "### Runtime images published"
echo ""
echo "- Version: \`${{ steps.tags.outputs.version }}\`"
echo "- Docker Hub repo: \`${{ steps.tags.outputs.dockerhub_image }}\`"
echo "- GHCR repo: \`${{ steps.tags.outputs.ghcr_image }}\`"
echo "- Full tags: \`${{ steps.tags.outputs.full_tag_args }}\`"
echo "- Slim tags: \`${{ steps.tags.outputs.slim_tag_args }}\`"
} >> "$GITHUB_STEP_SUMMARY"