Files
pinger/.gitea/workflows/cicd.yaml
T
bel faae75d5f4
cicd / ci (push) Failing after 41s
gitea
2026-06-27 16:44:56 -06:00

36 lines
1.0 KiB
YAML

name: cicd
on:
push:
branches:
- main
#paths:
#- '/**'
jobs:
ci:
name: ci
runs-on: dind
steps:
- name: checkout
uses: actions/checkout@v3
- name: ci
run: |
#! /bin/bash
set -ex
repo=$(grep url .git/config | awk '{print $NF}' | sed 's#.*\.[a-z]*/##' | sed 's#.git$##')
test -n "$repo"
if [[ "$repo" == *"template" ]]; then
exit 0
fi
img=registry-app.inhome.blapointe.com:5001/"$repo":"${1:-$(date +%Y%m%d%H%M)}"
was=$((docker inspect $img | jq -r .[0].Id | sed 's/^sha256://') || true)
docker build -f ./Dockerfile -t $img .
now=$(docker inspect $img | jq -r .[0].Id | sed 's/^sha256://')
docker push $img
if [ -n "$was" ] && [ "$was" != "null" ] && [ "$was" != "$now" ] && docker inspect "$was" &> /dev/null; then
docker rmi "$was" || true
docker rmi $(docker ps | grep ${img%:*} | grep '<none>' | awk '{print $3}') || true
fi