-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (86 loc) · 2.72 KB
/
Copy pathdocker.yml
File metadata and controls
95 lines (86 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build and Publish Docker Image
on:
push:
branches:
- main
paths:
- 'src/**'
- 'package*.json'
- 'tsconfig.json'
- 'Dockerfile'
- '.github/workflows/docker.yml'
pull_request:
branches:
- main
paths:
- 'src/**'
- 'package*.json'
- 'tsconfig.json'
- 'Dockerfile'
release:
types: [published]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# For releases: use semantic version
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# For main branch: use 'latest' and 'edge'
type=edge,branch=main
type=raw,value=latest,enable={{is_default_branch}}
# For PRs: use pr number
type=ref,event=pr
# For branches: use branch name
type=ref,event=branch
# Add commit SHA for traceability, but not for PRs
type=sha,prefix={{branch}}-,enable=${{ github.event_name != 'pull_request' }}
labels: |
org.opencontainers.image.title=XRootD MCP Server
org.opencontainers.image.description=Model Context Protocol server for XRootD file system access
org.opencontainers.image.vendor=EIC
maintainer=Wouter Deconinck
- name: Build and push Docker image
id: build
uses: docker/build-push-action@v7
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
provenance: true
- name: Output image tags
run: |
echo "🐳 Docker images published:"
echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n' | while read tag; do
echo " - $tag"
done