keep dry and upgrade the latest workflows
Some checks failed
Some checks failed
This commit is contained in:
parent
047239c8f0
commit
17744df2d7
38
.gitea/actions/docker-build-push/action.yaml
Normal file
38
.gitea/actions/docker-build-push/action.yaml
Normal file
@ -0,0 +1,38 @@
|
||||
name: 'Docker Build and Push'
|
||||
description: 'Extracts metadata and builds/pushes a Docker image'
|
||||
|
||||
inputs:
|
||||
registry_image:
|
||||
description: 'The registry and image name to tag (e.g., ghcr.io/user/repo)'
|
||||
required: true
|
||||
file:
|
||||
description: 'Path to the Dockerfile'
|
||||
required: false
|
||||
default: 'Dockerfile'
|
||||
platforms:
|
||||
description: 'Comma-separated list of platforms to build for'
|
||||
required: false
|
||||
default: 'linux/amd64'
|
||||
context:
|
||||
description: 'Build context path'
|
||||
required: false
|
||||
default: '.'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ inputs.registry_image }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ${{ inputs.context }}
|
||||
file: ${{ inputs.file }}
|
||||
platforms: ${{ inputs.platforms }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
11
.gitea/actions/docker-setup/action.yaml
Normal file
11
.gitea/actions/docker-setup/action.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
name: 'Docker Setup'
|
||||
description: 'Sets up QEMU and Docker Buildx for multi-platform builds'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
@ -35,36 +35,24 @@ jobs:
|
||||
ref: ${{ inputs.ref }}
|
||||
token: ${{ github.token }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Setup Docker (QEMU, Buildx)
|
||||
uses: martin/chromart-gitea-actions/.gitea/actions/docker-setup@main
|
||||
|
||||
- name: Load Infisical Secrets
|
||||
uses: martin/chromart-gitea-actions/.gitea/actions/infisical-secrets@main
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: martindmtrv
|
||||
# The Infisical secrets action needs to provide a secret named GHCR_PAT
|
||||
password: ${{ env.GHCR_PAT }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
# image_name should be formatted like: user/repo
|
||||
images: ghcr.io/${{ inputs.image_name }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
uses: martin/chromart-gitea-actions/.gitea/actions/docker-build-push@main
|
||||
with:
|
||||
context: .
|
||||
registry_image: ghcr.io/${{ inputs.image_name }}
|
||||
file: ${{ inputs.file }}
|
||||
platforms: ${{ inputs.platforms }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
context: .
|
||||
|
||||
@ -33,24 +33,13 @@ jobs:
|
||||
ref: ${{ inputs.ref }}
|
||||
token: ${{ github.token }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: 192.168.1.150:9120/${{ inputs.image_name }}
|
||||
- name: Setup Docker (QEMU, Buildx)
|
||||
uses: martin/chromart-gitea-actions/.gitea/actions/docker-setup@main
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
uses: martin/chromart-gitea-actions/.gitea/actions/docker-build-push@main
|
||||
with:
|
||||
context: .
|
||||
registry_image: 192.168.1.150:9120/${{ inputs.image_name }}
|
||||
file: ${{ inputs.file }}
|
||||
platforms: ${{ inputs.platforms }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
context: .
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user