From ce232fe3f80b231eb5c4fdd68db2cba79d1a2159 Mon Sep 17 00:00:00 2001 From: Joseph Nelson Date: Sat, 2 May 2026 22:19:43 -0700 Subject: [PATCH] created new step to delete old containers and imagess --- .gitea/workflows/build.yaml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 97bd748..f0f07c5 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,25 +1,33 @@ name: Build and Push Image on: [push] - jobs: build-and-push: runs-on: ubuntu-latest - # Required for building containers inside a containerized runner container: image: catthehacker/ubuntu:act-latest - + steps: - name: Checkout uses: actions/checkout@v3 - - name: Log in to Gitea Registry uses: docker/login-action@v2 with: registry: gitea.nelson-household.com # Replace with your Gitea domain username: ${{ gitea.actor }} password: ${{ secrets.RUNNER_TOKEN }} - + - name: Delete Old Images and Containers + run: | + CONTAINERS=$(docker ps -aqf "reference=gitea\.nelson-household\.com\/joseph\.nelson4456\/koillection-uploader\/koilcollection-uploader" || true) + IMAGES=$(docker images --filter "reference=gitea\.nelson-household\.com\/joseph\.nelson4456\/koillection-uploader\/koilcollection-uploader" -q) + if [ ! -z "$CONTAINERS" ]; then + echo "Deleting Containers:" + docker rm $CONTAINERS + fi + if [ ! -z "$IMAGES" ]; then + echo "Deleting Images:" + docker rmi $IMAGES + fi - name: Build and Push Image run: | - docker build -t gitea.nelson-household.com/joseph.nelson4456/koillection-uploader/koillection-uploader:${{ github.sha }} . - docker push gitea.nelson-household.com/joseph.nelson4456/koillection-uploader/koillection-uploader:${{ github.sha }} + docker build -t gitea.nelson-household.com/joseph.nelson4456/koillection-uploader/koilcollection-uploader:${{ github.sha }} . + docker push gitea.nelson-household.com/joseph.nelson4456/koillection-uploader/koilcollection-uploader:${{ github.sha }}