Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8a66447
docker hub publish
jigarkhwar May 24, 2026
8d11490
ci: split pr validation and publish
jigarkhwar May 24, 2026
7b6940b
ci: rename image to galaxio
jigarkhwar May 24, 2026
1716cf6
fix: make docker workflow self-contained
jigarkhwar May 24, 2026
3431721
ci: move docker publish to release
jigarkhwar May 24, 2026
67b86c6
ci: validate before docker publish
jigarkhwar May 24, 2026
c8633b2
ci: retrigger pr checks
jigarkhwar May 24, 2026
1abe274
ci: add docker check to pr workflow
jigarkhwar May 24, 2026
5616549
ci: wait for integration before docker image
jigarkhwar May 24, 2026
5b90200
ci: publish docker image after ci on main
jigarkhwar May 24, 2026
1cf1264
merge main into docker publish branch
jigarkhwar May 24, 2026
957680b
ci: tag docker image from release tag
jigarkhwar May 24, 2026
614d3c3
ci: publish release semver docker tags
jigarkhwar May 24, 2026
72db680
ci: drop docker major tag alias
jigarkhwar May 24, 2026
f7f48b6
ci: dedupe docker build and validate
jigarkhwar May 24, 2026
8b1e433
ci: extract docker release metadata
jigarkhwar May 24, 2026
a2c0132
ci: checkout before local docker action
jigarkhwar May 24, 2026
14a7574
ci: make main drive releases and docker publish
jigarkhwar May 24, 2026
fc821f5
ci: compute release version after main image build
jigarkhwar May 24, 2026
a38a75c
ci: publish docker image via buildkit cache
jigarkhwar May 24, 2026
50849ca
merge main into docker publish branch
jigarkhwar May 24, 2026
1ac7a14
ci: remove duplicate pr docker job
jigarkhwar May 24, 2026
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
47 changes: 0 additions & 47 deletions .github/actions/docker-release-metadata/action.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/actions/release-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: release-version
description: Compute the next release version from conventional commits since the latest tag.

outputs:
bump:
description: Version bump kind.
value: ${{ steps.version.outputs.bump }}
version:
description: Next semver without the v prefix.
value: ${{ steps.version.outputs.version }}
tag_name:
description: Next git tag with the v prefix.
value: ${{ steps.version.outputs.tag_name }}
minor_tag:
description: Major.minor Docker tag alias.
value: ${{ steps.version.outputs.minor_tag }}
previous_tag:
description: Previous git tag used as the release base.
value: ${{ steps.version.outputs.previous_tag }}

runs:
using: composite
steps:
- name: Compute next version
id: version
shell: bash
run: |
set -euo pipefail

previous_tag="$(git tag --list 'v*' --sort=-version:refname | head -n1)"
if [[ -z "${previous_tag}" ]]; then
previous_tag="v0.0.0"
range="HEAD"
else
range="${previous_tag}..HEAD"
fi

bump="patch"
if git log --format='%s%n%b' "${range}" | grep -Eq 'BREAKING CHANGE|^[^[:space:]:]+(\([^)]+\))?!:'; then
bump="major"
elif git log --format='%s' "${range}" | grep -Eq '^feat(\([^)]+\))?: '; then
bump="minor"
fi

version_core="${previous_tag#v}"
IFS='.' read -r major minor patch <<< "${version_core}"

case "${bump}" in
major)
major=$((major + 1))
minor=0
patch=0
;;
minor)
minor=$((minor + 1))
patch=0
;;
patch)
patch=$((patch + 1))
;;
esac

version="${major}.${minor}.${patch}"

{
echo "bump=${bump}"
echo "version=${version}"
echo "tag_name=v${version}"
echo "minor_tag=${major}.${minor}"
echo "previous_tag=${previous_tag}"
} >> "${GITHUB_OUTPUT}"
206 changes: 200 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,24 @@ jobs:
- name: Build
run: go build -trimpath -o dist/galaxio ./cmd/galaxio

docker-image:
integration:
name: integration tests
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Integration tests
run: go test -tags=integration -race -count=1 ./...

docker-image-pr:
name: docker image
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
Expand All @@ -80,19 +97,196 @@ jobs:
version: dev
image_tag: galax-io/galaxio:pr-${{ github.event.pull_request.number }}-${{ github.sha }}

integration:
name: integration tests
docker-image-main:
name: docker image
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- test
- integration
outputs:
bump: ${{ steps.version.outputs.bump }}
version: ${{ steps.version.outputs.version }}
tag_name: ${{ steps.version.outputs.tag_name }}
minor_tag: ${{ steps.version.outputs.minor_tag }}
previous_tag: ${{ steps.version.outputs.previous_tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
fetch-depth: 0
fetch-tags: true

- name: Compute release version
id: version
uses: ./.github/actions/release-version

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Prepare image build metadata
id: buildmeta
shell: bash
run: |
set -euo pipefail

commit="$(git rev-parse --short=12 HEAD)"
date="$(git log -1 --format=%cI HEAD)"

{
echo "build_args<<EOF"
printf 'VERSION=%s\nCOMMIT=%s\nDATE=%s\n' "${{ steps.version.outputs.version }}" "${commit}" "${date}"
echo "EOF"
} >> "${GITHUB_OUTPUT}"

- name: Build image locally with BuildKit cache
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
load: true
push: false
tags: galax-io/galaxio:${{ steps.version.outputs.version }}
build-args: ${{ steps.buildmeta.outputs.build_args }}
cache-to: type=local,dest=/tmp/buildx-cache,mode=max
provenance: false

- name: Validate image with utility command
run: docker run --rm galax-io/galaxio:${{ steps.version.outputs.version }} version

- name: Upload BuildKit cache artifact
uses: actions/upload-artifact@v4
with:
name: buildx-cache-${{ github.sha }}
path: /tmp/buildx-cache
if-no-files-found: error
retention-days: 1

release:
name: release
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- docker-image-main
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
fetch-depth: 0
fetch-tags: true

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true

- name: Integration tests
run: go test -tags=integration -race -count=1 ./...
- name: Create and push git tag
env:
TAG_NAME: ${{ needs.docker-image-main.outputs.tag_name }}
run: |
set -euo pipefail

if git ls-remote --exit-code --tags origin "refs/tags/${TAG_NAME}" >/dev/null 2>&1; then
echo "Tag ${TAG_NAME} already exists on origin, skipping push."
exit 0
fi

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "${TAG_NAME}" -m "Release ${TAG_NAME}"
git push origin "${TAG_NAME}"

- name: Check existing GitHub release
id: release_exists
env:
TAG_NAME: ${{ needs.docker-image-main.outputs.tag_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail

if gh release view "${TAG_NAME}" >/dev/null 2>&1; then
echo "exists=true" >> "${GITHUB_OUTPUT}"
else
echo "exists=false" >> "${GITHUB_OUTPUT}"
fi

- name: Run GoReleaser
if: steps.release_exists.outputs.exists != 'true'
uses: goreleaser/goreleaser-action@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
distribution: goreleaser
version: latest
args: release --clean

publish-image:
name: publish image
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- docker-image-main
- release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
fetch-depth: 0
fetch-tags: true

- name: Download BuildKit cache artifact
uses: actions/download-artifact@v4
with:
name: buildx-cache-${{ github.sha }}
path: /tmp/buildx-cache

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Prepare image build metadata
id: buildmeta
env:
VERSION: ${{ needs.docker-image-main.outputs.version }}
run: |
set -euo pipefail

commit="$(git rev-parse --short=12 HEAD)"
date="$(git log -1 --format=%cI HEAD)"

{
echo "build_args<<EOF"
printf 'VERSION=%s\nCOMMIT=%s\nDATE=%s\n' "${VERSION}" "${commit}" "${date}"
echo "EOF"
echo "tags<<EOF"
printf '%s\n' \
"galax-io/galaxio:${VERSION}" \
"galax-io/galaxio:${{ needs.docker-image-main.outputs.minor_tag }}" \
"galax-io/galaxio:latest"
echo "EOF"
} >> "${GITHUB_OUTPUT}"

- name: Build and push image with BuildKit
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.buildmeta.outputs.tags }}
build-args: ${{ steps.buildmeta.outputs.build_args }}
cache-from: type=local,src=/tmp/buildx-cache
provenance: false
Loading
Loading