refactor(ci): remove development build job from Docker workflow and update docker-tags script to include dev tagging

This commit is contained in:
Ivan
2026-04-04 22:15:25 -05:00
parent fb16f8926a
commit 903f7dead4
2 changed files with 5 additions and 57 deletions
-57
View File
@@ -12,7 +12,6 @@ on:
env:
REGISTRY: git.quad4.io
IMAGE_NAME: rns-things/meshchatx
DEV_IMAGE_NAME: rns-things/meshchatx-dev
jobs:
build:
@@ -69,59 +68,3 @@ jobs:
- name: Scan Docker image
run: trivy image --exit-code 0 "${{ steps.tags.outputs.first_tag }}"
build-dev:
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
run: |
set -eu
SERVER="${GITEA_SERVER_URL:-${GITHUB_SERVER_URL:-}}"
REPO="${GITEA_REPOSITORY:-${GITHUB_REPOSITORY:-}}"
if [ -z "$SERVER" ] || [ -z "$REPO" ]; then
echo "Checkout: set GITEA_SERVER_URL/GITEA_REPOSITORY or GITHUB_SERVER_URL/GITHUB_REPOSITORY" >&2
exit 1
fi
if [ -n "${GITEA_TOKEN:-}" ] || [ -n "${GITHUB_TOKEN:-}" ]; then
TOKEN="${GITEA_TOKEN:-$GITHUB_TOKEN}"
git config --global credential.helper "!f() { echo username=x-access-token; echo password=${TOKEN}; }; f"
fi
git clone "${SERVER}/${REPO}.git" .
git checkout "${GITHUB_SHA}"
- name: Set up Docker (QEMU + Buildx + Login)
run: sh scripts/ci/setup-docker.sh "${{ env.REGISTRY }}" "${{ secrets.REGISTRY_USERNAME }}" "${{ secrets.REGISTRY_PASSWORD }}"
- name: Download Trivy
run: |
curl -L -o /tmp/trivy.deb https://git.quad4.io/Quad4-Software/Trivy-Assets/raw/commit/fdfe96b77d2f7b7f5a90cea00af5024c9f728f17/trivy_0.69.3_Linux-64bit.deb
sh scripts/ci/exec-priv.sh dpkg -i /tmp/trivy.deb || sh scripts/ci/exec-priv.sh apt-get install -f -y
- name: Trivy FS scan
run: trivy fs --exit-code 1 .
- name: Generate dev Docker tags
id: tags
run: |
DEV_IMAGE="${{ env.REGISTRY }}/${{ env.DEV_IMAGE_NAME }}"
SHA="$(git rev-parse --short HEAD)"
TAGS="-t ${DEV_IMAGE}:dev -t ${DEV_IMAGE}:sha-${SHA}"
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
echo "first_tag=${DEV_IMAGE}:dev" >> "$GITHUB_OUTPUT"
- name: Build and push dev Docker image
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--push \
--no-cache \
${{ steps.tags.outputs.tags }} \
-f ./Dockerfile .
- name: Scan Docker image (dev)
run: trivy image --exit-code 0 "${{ steps.tags.outputs.first_tag }}"
+5
View File
@@ -22,15 +22,20 @@ case "$BRANCH" in
master|main)
echo "-t ${IMAGE}:latest" >> "$OUTPUT"
;;
dev)
echo "-t ${IMAGE}:dev" >> "$OUTPUT"
;;
esac
case "$REF" in
refs/tags/v*)
VERSION="${REF#refs/tags/v}"
echo "-t ${IMAGE}:${VERSION}" >> "$OUTPUT"
echo "-t ${IMAGE}:v${VERSION}" >> "$OUTPUT"
MAJOR_MINOR="$(echo "$VERSION" | cut -d. -f1-2)"
if [ "$MAJOR_MINOR" != "$VERSION" ]; then
echo "-t ${IMAGE}:${MAJOR_MINOR}" >> "$OUTPUT"
echo "-t ${IMAGE}:v${MAJOR_MINOR}" >> "$OUTPUT"
fi
;;
refs/tags/*)