actions/docker/action.yaml
2024-08-14 16:39:47 +02:00

42 lines
1.3 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') }}
env:
DOCKER_IMAGE: ${{ inputs.registry }}/${{ gitea.repository }}
run: |
docker tag $DOCKER_IMAGE:main $DOCKER_IMAGE:latest
docker push $DOCKER_IMAGE:latest