Files
koillection-uploader/.gitea/workflows/build.yaml
T
joseph.nelson4456 ce232fe3f8
Build and Push Image / build-and-push (push) Successful in 1m20s
created new step to delete old containers and imagess
2026-05-02 22:19:43 -07:00

34 lines
1.4 KiB
YAML

name: Build and Push Image
on: [push]
jobs:
build-and-push:
runs-on: ubuntu-latest
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/koilcollection-uploader:${{ github.sha }} .
docker push gitea.nelson-household.com/joseph.nelson4456/koillection-uploader/koilcollection-uploader:${{ github.sha }}