2024-08-03 10:12:03 +00:00
|
|
|
name: Docker deploy
|
|
|
|
description: Deploy docker image to Gitea
|
2024-08-01 20:08:21 +00:00
|
|
|
|
|
|
|
inputs:
|
|
|
|
registry:
|
|
|
|
description: "Server address of Docker registry."
|
2024-08-02 11:07:09 +00:00
|
|
|
default: ${{ vars.CONTAINER_REGISTRY }}
|
2024-08-01 20:37:53 +00:00
|
|
|
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
|
2024-08-01 20:08:21 +00:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: composite
|
|
|
|
steps:
|
|
|
|
- uses: docker/metadata-action@v5
|
|
|
|
id: meta
|
|
|
|
with:
|
2024-08-01 20:13:35 +00:00
|
|
|
images: ${{ inputs.registry }}/${{ gitea.repository }}
|
2024-08-01 20:08:21 +00:00
|
|
|
- uses: docker/login-action@v3
|
|
|
|
with:
|
2024-08-01 20:13:35 +00:00
|
|
|
registry: ${{ inputs.registry }}
|
2024-08-01 20:37:53 +00:00
|
|
|
username: ${{ inputs.username }}
|
|
|
|
password: ${{ inputs.password }}
|
2024-08-01 20:08:21 +00:00
|
|
|
- uses: docker/build-push-action@v6
|
2024-08-14 14:25:42 +00:00
|
|
|
if: ${{ !startsWith(gitea.ref, 'refs/tags/v') }}
|
2024-08-01 20:08:21 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2024-08-14 14:11:52 +00:00
|
|
|
- name: Push tags
|
|
|
|
shell: bash
|
2024-08-14 14:25:42 +00:00
|
|
|
if: ${{ startsWith(gitea.ref, 'refs/tags/v') }}
|
2024-08-14 14:39:47 +00:00
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: ${{ inputs.registry }}/${{ gitea.repository }}
|
2024-08-14 14:11:52 +00:00
|
|
|
run: |
|
2024-08-14 14:39:47 +00:00
|
|
|
docker tag $DOCKER_IMAGE:main $DOCKER_IMAGE:latest
|
|
|
|
docker push $DOCKER_IMAGE:latest
|