test tag push

This commit is contained in:
Evan Jarrett
2025-11-03 16:37:39 -06:00
parent 6b56f18715
commit 9bd49b9e49
3 changed files with 56 additions and 16 deletions
@@ -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: |
+26 -3
View File
@@ -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} \
+1 -1
View File
@@ -1,6 +1,6 @@
when:
- event: ["push"]
branch: ["main"]
branch: ["main", "test"]
- event: ["pull_request"]
branch: ["main"]