Skip to content

chore(deps)(deps): bump actions/checkout from 4 to 6 #23

chore(deps)(deps): bump actions/checkout from 4 to 6

chore(deps)(deps): bump actions/checkout from 4 to 6 #23

name: Docker Build and Publish
on:
push:
branches:
- main
- master
tags:
- 'v*'
pull_request:
branches:
- main
- master
workflow_run:
workflows: ["CodeQL Security Scan"]
types:
- completed
env:
REGISTRY: ghcr.io
SERVER_IMAGE_NAME: ${{ github.repository }}/server
CLIENT_IMAGE_NAME: ${{ github.repository }}/client
jobs:
build-and-push:
runs-on: ubuntu-latest
# Run on: manual triggers, successful CodeQL completion, or tag pushes
# workflow_run handles PR/push events after CodeQL succeeds
# Tag pushes trigger directly for releases
if: |
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Server
id: meta-server
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.SERVER_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Extract metadata for Client
id: meta-client
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.CLIENT_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build and push Server image
uses: docker/build-push-action@v5
with:
context: .
file: ./file-storage-server/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-server.outputs.tags }}
labels: ${{ steps.meta-server.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push Client image
uses: docker/build-push-action@v5
with:
context: .
file: ./file-storage-client/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-client.outputs.tags }}
labels: ${{ steps.meta-client.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max