diff --git a/.forgejo/workflows/build-container-nix.yaml b/.forgejo/workflows/build-container-nix.yaml index f66691f..b3d1d57 100644 --- a/.forgejo/workflows/build-container-nix.yaml +++ b/.forgejo/workflows/build-container-nix.yaml @@ -4,8 +4,8 @@ # Pushes to Zot registry via skopeo # # Examples: -# nettest-nix-v1.0.0 -> builds containers/nettest/default.nix -# myapp-nix-v2.1.0 -> builds containers/myapp/default.nix +# nettest-nix-v1.0.0 -> builds containers/nettest/default.nix, pushes :v1.0.0-nix +# myapp-nix-v2.1.0 -> builds containers/myapp/default.nix, pushes :v2.1.0-nix name: Build Container (Nix) on: @@ -80,7 +80,7 @@ jobs: run: | CONTAINER="${{ steps.parse.outputs.container }}" VERSION="${{ steps.parse.outputs.version }}" - IMAGE="registry.ops.eblu.me/blumeops/$CONTAINER:$VERSION" + IMAGE="registry.ops.eblu.me/blumeops/$CONTAINER:$VERSION-nix" echo "Pushing to $IMAGE" skopeo copy \ diff --git a/mise-tasks/container-tag-and-release b/mise-tasks/container-tag-and-release index e86484d..e47be5c 100755 --- a/mise-tasks/container-tag-and-release +++ b/mise-tasks/container-tag-and-release @@ -15,8 +15,8 @@ When a container has both a Dockerfile and default.nix, both tags are created by default. Use --nix or --dockerfile to release only one variant. Tag conventions: - -v -> triggers build-container.yaml (Dockerfile) - -nix-v -> triggers build-container-nix.yaml (Nix) + -v -> build-container.yaml -> :v + -nix-v -> build-container-nix.yaml -> :v-nix """ import re @@ -60,17 +60,17 @@ def list_containers() -> None: typer.echo(f" - {d.name} ({', '.join(types)})") -def create_and_push_tag(tag: str, image: str, version: str, dry_run: bool) -> bool: +def create_and_push_tag(tag: str, image: str, image_tag: str, dry_run: bool) -> bool: """Create a git tag and push it. Returns True on success.""" if git_tag_exists(tag): typer.echo(f" Skip: Tag '{tag}' already exists") return False if dry_run: - typer.echo(f" [dry-run] Would create and push: {tag} -> {REGISTRY}/{image}:{version}") + typer.echo(f" [dry-run] Would create and push: {tag} -> {REGISTRY}/{image}:{image_tag}") else: git("tag", tag) git("push", "origin", tag) - typer.echo(f" {tag} -> {REGISTRY}/{image}:{version}") + typer.echo(f" {tag} -> {REGISTRY}/{image}:{image_tag}") return True @@ -135,9 +135,11 @@ def main( for build in builds: if build == "nix": tag = f"{container}-nix-{version}" + image_tag = f"{version}-nix" else: tag = f"{container}-{version}" - if create_and_push_tag(tag, image, version, dry_run): + image_tag = version + if create_and_push_tag(tag, image, image_tag, dry_run): tags_created += 1 if tags_created == 0: