mirror of
https://github.com/safedep/vet.git
synced 2025-12-10 00:22:08 -06:00
ci: tag container image release (#407)
Co-authored-by: Kunal Singh <kunalsin9h@gmail.com>
This commit is contained in:
parent
c1d9050d26
commit
4be215d914
31
.github/workflows/container.yml
vendored
31
.github/workflows/container.yml
vendored
@ -18,7 +18,7 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: "!contains(github.event.commits[0].message, '[noci]')"
|
||||
if: '!contains(github.event.commits[0].message, "[noci]")'
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
@ -47,8 +47,31 @@ jobs:
|
||||
|
||||
- name: Build and Push Container Image
|
||||
run: |
|
||||
docker buildx build --push --platform linux/amd64 --platform linux/arm64 \
|
||||
-t $REGISTRY/$IMAGE_NAME:latest \
|
||||
.
|
||||
# Get the tag if this was a tag push event
|
||||
if [[ "${{ github.ref_type }}" == "tag" ]]; then
|
||||
TAG=${{ github.ref_name }}
|
||||
# Validate tag format (must be vX.Y.Z)
|
||||
if [[ $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
# Build and push with both version tag and latest
|
||||
docker buildx build --push --platform linux/amd64,linux/arm64 \
|
||||
-t $REGISTRY/$IMAGE_NAME:$TAG \
|
||||
-t $REGISTRY/$IMAGE_NAME:latest \
|
||||
.
|
||||
else
|
||||
echo "Invalid tag format. Must be in format vX.Y.Z (e.g. v1.2.3)"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# For non-tag pushes, just use latest tag
|
||||
docker buildx build --push --platform linux/amd64,linux/arm64 \
|
||||
-t $REGISTRY/$IMAGE_NAME:latest \
|
||||
.
|
||||
fi
|
||||
|
||||
- uses: actions/delete-package-versions@e5bc658cc4c965c472efe991f8beea3981499c55 # v5.0.0
|
||||
name: Remove Old Container Images
|
||||
with:
|
||||
package-name: vet
|
||||
package-type: 'container'
|
||||
delete-only-untagged-versions: 'true'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user