addet workflows!
Some checks failed
Build and Push to Forgejo Registry / build (push) Has been cancelled

This commit is contained in:
pika 2025-04-06 20:41:55 +02:00
parent 0683f18868
commit 9d952d0a70
2 changed files with 24 additions and 53 deletions

View file

@ -1,34 +1,27 @@
name: Build and Push Docker Image
name: Build and Push to Forgejo Registry
on:
push:
branches:
- main
branches: [main]
schedule:
# Run every Sunday at 00:00 UTC (adjust cron syntax as needed)
- cron: "0 0 * * 0"
- cron: "0 0 * * 0" # Weekly at 00:00 UTC Sunday
jobs:
docker:
runs-on: docker
build:
runs-on: debian-x86-runner # Your runner's name
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to Docker Registry
- name: Log in to Forgejo Container Registry
uses: docker/login-action@v3
with:
registry: git.k4li.de
# username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.FORGEJO_ACCESSTOKEN }}
registry: git.k4li.de # Your Forgejo instance
username: ${{ secrets.FORGEJO_USERNAME }} # Your Forgejo username
password: ${{ secrets.FORGEJO_PASSWORD }} # PAT (Personal Access Token)
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: |
docker/caddy:latest
docker/caddy:${{ github.sha }}
- name: Run Custom Build Script
run: ./build.sh
env:
# Pass registry URL to script (optional)
REGISTRY: git.k4li.de/docker/caddy

View file

@ -35,37 +35,15 @@ tag=latest
container="${domain}/${image}:${tag}"
askToPush() {
echo_info "Do you want to push directly to $domain?"
read -r push_
case "$push_" in
[yY])
push=true
;;
[nN])
push=false
;;
*)
echo_warning "You entered something wrong!"
askToPush
;;
esac
if $push; then
docker push "$container"
fi
}
if ! command_exists docker; then
echo_error "Docker does not exist!"
exit 1
fi
[[ ! -e ./Dockerfile ]] &&
echo_error "Dockerfile does not exist" &&
exit 1
# if ! command_exists docker; then
# echo_error "Docker does not exist!"
# exit 1
# fi
#
# [[ ! -e ./Dockerfile ]] &&
# echo_error "Dockerfile does not exist" &&
# exit 1
#
docker build -t "$container" .
askToPush
docker push "$container"