Skip to content

Commit f1b50dd

Browse files
committed
chore: add GitHub Actions workflow for Docker image publishing
1 parent 918e45d commit f1b50dd

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Publish Docker images
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
tags:
7+
- "v*.*.*"
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
GHCR_REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}
15+
16+
jobs:
17+
publish:
18+
name: Build and push Docker image
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Login to GHCR
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.repository_owner }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Login to Docker Hub
41+
uses: docker/login-action@v3
42+
with:
43+
registry: docker.io
44+
username: ${{ secrets.DOCKERHUB_USERNAME }}
45+
password: ${{ secrets.DOCKERHUB_TOKEN }}
46+
47+
- name: Extract metadata
48+
id: meta
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: |
52+
ghcr.io/${{ github.repository }}
53+
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/one-search-mcp
54+
tags: |
55+
type=semver,pattern={{version}}
56+
type=semver,pattern={{major}}.{{minor}}
57+
type=semver,pattern={{major}}
58+
type=raw,value=latest,enable={{is_default_branch}}
59+
60+
- name: Build and push
61+
uses: docker/build-push-action@v6
62+
with:
63+
context: .
64+
platforms: linux/amd64,linux/arm64
65+
push: true
66+
tags: ${{ steps.meta.outputs.tags }}
67+
labels: ${{ steps.meta.outputs.labels }}
68+
cache-from: type=gha
69+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)