41 lines
1.2 KiB
YAML
41 lines
1.2 KiB
YAML
name: Docker deploy
|
|
description: Deploy docker image to Gitea
|
|
|
|
inputs:
|
|
registry:
|
|
description: "Server address of Docker registry."
|
|
default: ${{ vars.CONTAINER_REGISTRY }}
|
|
username:
|
|
description: "Username used to log against the Docker registry"
|
|
default: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
|
password:
|
|
description: "Password or personal access token used to log against the Docker registry"
|
|
required: true
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- uses: docker/metadata-action@v5
|
|
id: meta
|
|
with:
|
|
images: ${{ inputs.registry }}/${{ gitea.repository }}
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ inputs.registry }}
|
|
username: ${{ inputs.username }}
|
|
password: ${{ inputs.password }}
|
|
- uses: docker/build-push-action@v6
|
|
if: ${{ !startsWith(gitea.ref, 'refs/tags/v') }}
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
- name: Push tags
|
|
shell: bash
|
|
if: ${{ startsWith(gitea.ref, 'refs/tags/v') }}
|
|
run: |
|
|
for tag in ${{ steps.meta.outputs.tags }}; do
|
|
docker push ${{ inputs.registry }}/${{ gitea.repository }}:$tag
|
|
done
|