Files
daniel156161 44937b6493
Build and Push Docker Container / build-and-push (push) Failing after 12m23s
update build workflow
2026-04-11 23:31:44 +02:00

64 lines
1.9 KiB
YAML

name: Build and Push Docker Container
on:
schedule:
- cron: "0 11 * * 5"
push:
branches:
- main
- alpine
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
# --- Logins ---
- name: Login to Gitea Registry
if: ${{ github.ref == 'refs/heads/alpine' }}
uses: docker/login-action@v4
with:
registry: ${{ vars.DOCKER_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.ACTION_ACCESS_TOKEN }}
- name: Login to Docker Hub
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# ---------------- BRANCH BUILD (main) ----------------
# On Branch main: Docker Hub :latest
# On Branch alpine: Gitea :alpine
- name: Repo owner to lowercase
run: echo "REPO_OWNER_LC=$(echo '${{ gitea.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build and push main image to Docker Hub
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v7
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/borgbackup-ssh:latest
- name: Build and push Alpine image to Gitea
if: ${{ github.ref == 'refs/heads/alpine' }}
uses: docker/build-push-action@v7
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ vars.DOCKER_REGISTRY_URL }}/${{ env.REPO_OWNER_LC }}/borgbackup-ssh:alpine