mirror of
https://github.com/driftywinds/twitchrise-bot.git
synced 2025-12-19 11:43:33 +00:00
Update build.yml
This commit is contained in:
27
.github/workflows/build.yml
vendored
27
.github/workflows/build.yml
vendored
@@ -3,6 +3,10 @@ name: Multi-Arch Docker Build & Push
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
image_name:
|
||||
description: "Image name without registry (e.g. myuser/myimage)"
|
||||
required: true
|
||||
type: string
|
||||
tags:
|
||||
description: "Comma-separated list of tags (e.g. v1.0.1,latest,dev,beta)"
|
||||
required: true
|
||||
@@ -50,7 +54,7 @@ jobs:
|
||||
done
|
||||
echo "tags_list=${CLEAN_TAGS[*]}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Login (optional per registry)
|
||||
# Logins
|
||||
- name: Login to Docker Hub
|
||||
if: ${{ github.event.inputs.push_dockerhub == 'true' }}
|
||||
uses: docker/login-action@v3
|
||||
@@ -74,23 +78,21 @@ jobs:
|
||||
username: ${{ secrets.QUAY_USERNAME }}
|
||||
password: ${{ secrets.QUAY_TOKEN }}
|
||||
|
||||
# Build once and store in local cache
|
||||
# Build once and save to local cache
|
||||
- name: Build multi-arch image
|
||||
run: |
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--output=type=registry,dest=/tmp/buildcache.tar \
|
||||
--output=type=docker \
|
||||
-t tempimage:build .
|
||||
shell: bash
|
||||
|
||||
# Push to Docker Hub
|
||||
- name: Push to Docker Hub
|
||||
if: ${{ github.event.inputs.push_dockerhub == 'true' }}
|
||||
run: |
|
||||
docker load < /tmp/buildcache.tar || true
|
||||
for tag in ${{ steps.vars.outputs.tags_list }}; do
|
||||
docker tag tempimage:build docker.io/${{ secrets.DOCKERHUB_USERNAME }}/$(basename $GITHUB_REPOSITORY):$tag
|
||||
docker push docker.io/${{ secrets.DOCKERHUB_USERNAME }}/$(basename $GITHUB_REPOSITORY):$tag || echo "Docker Hub push failed for tag $tag"
|
||||
docker tag tempimage:build docker.io/${{ github.event.inputs.image_name }}:$tag
|
||||
docker push docker.io/${{ github.event.inputs.image_name }}:$tag || echo "Docker Hub push failed for tag $tag"
|
||||
done
|
||||
continue-on-error: true
|
||||
|
||||
@@ -98,11 +100,9 @@ jobs:
|
||||
- name: Push to GHCR
|
||||
if: ${{ github.event.inputs.push_ghcr == 'true' }}
|
||||
run: |
|
||||
docker load < /tmp/buildcache.tar || true
|
||||
REPO_NAME=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
|
||||
for tag in ${{ steps.vars.outputs.tags_list }}; do
|
||||
docker tag tempimage:build ghcr.io/$REPO_NAME:$tag
|
||||
docker push ghcr.io/$REPO_NAME:$tag || echo "GHCR push failed for tag $tag"
|
||||
docker tag tempimage:build ghcr.io/${{ github.event.inputs.image_name }}:$tag
|
||||
docker push ghcr.io/${{ github.event.inputs.image_name }}:$tag || echo "GHCR push failed for tag $tag"
|
||||
done
|
||||
continue-on-error: true
|
||||
|
||||
@@ -110,9 +110,8 @@ jobs:
|
||||
- name: Push to Quay.io
|
||||
if: ${{ github.event.inputs.push_quay == 'true' }}
|
||||
run: |
|
||||
docker load < /tmp/buildcache.tar || true
|
||||
for tag in ${{ steps.vars.outputs.tags_list }}; do
|
||||
docker tag tempimage:build quay.io/${{ secrets.QUAY_USERNAME }}/$(basename $GITHUB_REPOSITORY):$tag
|
||||
docker push quay.io/${{ secrets.QUAY_USERNAME }}/$(basename $GITHUB_REPOSITORY):$tag || echo "Quay push failed for tag $tag"
|
||||
docker tag tempimage:build quay.io/${{ github.event.inputs.image_name }}:$tag
|
||||
docker push quay.io/${{ github.event.inputs.image_name }}:$tag || echo "Quay push failed for tag $tag"
|
||||
done
|
||||
continue-on-error: true
|
||||
|
||||
Reference in New Issue
Block a user