From 9bd49b9e499585bbb03e97238fbab1fe2e39a87a Mon Sep 17 00:00:00 2001 From: Evan Jarrett Date: Mon, 3 Nov 2025 13:45:59 -0600 Subject: [PATCH] test tag push --- .../workflows/release-credential-helper.yml | 41 +++++++++++++------ .tangled/workflows/release.yml | 29 +++++++++++-- .tangled/workflows/tests.yml | 2 +- 3 files changed, 56 insertions(+), 16 deletions(-) diff --git a/.tangled/workflows/release-credential-helper.yml b/.tangled/workflows/release-credential-helper.yml index fedf229..d15e003 100644 --- a/.tangled/workflows/release-credential-helper.yml +++ b/.tangled/workflows/release-credential-helper.yml @@ -3,33 +3,45 @@ # This workflow builds the docker-credential-atcr binary and publishes it # to Tangled.org for distribution via Homebrew. # -# Current limitation: Tangled doesn't support triggering on tags yet, -# so this triggers on push to main. Manually verify you've tagged the -# release before pushing. +# Triggers on version tags (v*) pushed to the repository. when: - - event: ["manual"] - branch: ["main"] + - event: ["push"] + tag: ["v*"] engine: "nixery" dependencies: nixpkgs: - go_1_24 # Go 1.24+ for building - - git # For finding tags - goreleaser # For building multi-platform binaries + - curl # Required by go generate for downloading vendor assets + - gnugrep # Required for tag detection # - goat # TODO: Add goat CLI for uploading to Tangled (if available in nixpkgs) environment: CGO_ENABLED: "0" # Build static binaries steps: - - name: Find latest git tag + - name: Get tag for current commit command: | - # Get the most recent version tag - LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.1") - echo "Latest tag: $LATEST_TAG" - echo "$LATEST_TAG" > .version + # Fetch tags (shallow clone doesn't include them by default) + git fetch --tags + + # Find the tag that points to the current commit + TAG=$(git tag --points-at HEAD | grep -E '^v[0-9]' | head -n1) + + if [ -z "$TAG" ]; then + echo "Error: No version tag found for current commit" + echo "Available tags:" + git tag + echo "Current commit:" + git rev-parse HEAD + exit 1 + fi + + echo "Building version: $TAG" + echo "$TAG" > .version # Also get the commit hash for reference COMMIT_HASH=$(git rev-parse HEAD) @@ -47,7 +59,12 @@ steps: # List what was built echo "Built artifacts:" - ls -lh dist/ + if [ -d "dist" ]; then + ls -lh dist/ + else + echo "Error: dist/ directory was not created by GoReleaser" + exit 1 + fi - name: Package artifacts command: | diff --git a/.tangled/workflows/release.yml b/.tangled/workflows/release.yml index 7befb53..c900255 100644 --- a/.tangled/workflows/release.yml +++ b/.tangled/workflows/release.yml @@ -3,21 +3,40 @@ when: - event: ["manual"] - # TODO: Trigger only on version tags (v1.0.0, v2.1.3, etc.) - branch: ["main"] + tag: ["v*"] engine: "nixery" dependencies: nixpkgs: - buildah - - chroot + - gnugrep # Required for tag detection environment: IMAGE_REGISTRY: atcr.io IMAGE_USER: evan.jarrett.net steps: + - name: Get tag for current commit + command: | + # Fetch tags (shallow clone doesn't include them by default) + git fetch --tags + + # Find the tag that points to the current commit + TAG=$(git tag --points-at HEAD | grep -E '^v[0-9]' | head -n1) + + if [ -z "$TAG" ]; then + echo "Error: No version tag found for current commit" + echo "Available tags:" + git tag + echo "Current commit:" + git rev-parse HEAD + exit 1 + fi + + echo "Building version: $TAG" + echo "$TAG" > .version + - name: Setup build environment command: | if ! grep -q "^root:" /etc/passwd 2>/dev/null; then @@ -34,6 +53,8 @@ steps: - name: Build and push AppView image command: | + TAG=$(cat .version) + buildah bud \ --storage-driver vfs \ --tag ${IMAGE_REGISTRY}/${IMAGE_USER}/atcr-appview:${TAG} \ @@ -47,6 +68,8 @@ steps: - name: Build and push Hold image command: | + TAG=$(cat .version) + buildah bud \ --storage-driver vfs \ --tag ${IMAGE_REGISTRY}/${IMAGE_USER}/atcr-hold:${TAG} \ diff --git a/.tangled/workflows/tests.yml b/.tangled/workflows/tests.yml index d2acadd..26d366b 100644 --- a/.tangled/workflows/tests.yml +++ b/.tangled/workflows/tests.yml @@ -1,6 +1,6 @@ when: - event: ["push"] - branch: ["main"] + branch: ["main", "test"] - event: ["pull_request"] branch: ["main"]