Files
ChatBot/.gitea/workflows/publish-docker.yml
Leonid Pershin 3adbc189eb
All checks were successful
SonarQube / Build and analyze (pull_request) Successful in 3m10s
Tests / Run Tests (pull_request) Successful in 2m37s
add
2025-10-22 12:38:16 +03:00

54 lines
1.6 KiB
YAML

name: Publish Docker Image
on:
workflow_run:
workflows: ["SonarQube", "Tests"]
types:
- completed
branches:
- master
jobs:
publish:
name: Build and Publish to Harbor
runs-on: ubuntu-latest
# Запускаем только если предыдущий workflow успешно завершился
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Harbor
uses: docker/login-action@v3
with:
registry: harbor.home
username: robot$chatbot
password: ${{ secrets.HARBOR_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: harbor.home/chatbot/chatbot
tags: |
type=ref,event=branch
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./ChatBot
file: ./ChatBot/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=harbor.home/chatbot/chatbot:buildcache
cache-to: type=registry,ref=harbor.home/chatbot/chatbot:buildcache,mode=max
- name: Image digest
run: echo "Image published with digest ${{ steps.build.outputs.digest }}"