fork of https://github.com/sourcegraph/zoekt
1name: Publish Docker Image
2
3on:
4 push:
5 branches:
6 - main
7 tags:
8 - 'v*'
9 workflow_dispatch:
10
11jobs:
12 docker:
13 runs-on: ubuntu-latest
14 permissions:
15 contents: read
16 packages: write
17 steps:
18 - name: checkout
19 uses: actions/checkout@v4
20 with:
21 fetch-depth: 0
22
23 - name: version
24 id: version
25 run: .github/workflows/docker-version.sh
26
27 - name: setup-buildx
28 uses: docker/setup-buildx-action@v3
29
30 - name: docker-meta
31 id: meta
32 uses: docker/metadata-action@v5
33 with:
34 images: ghcr.io/${{ github.repository }}
35 tags: |
36 type=semver,pattern={{version}}
37 type=semver,pattern={{major}}.{{minor}}
38 type=raw,value=${{ steps.version.outputs.value }},enable={{is_default_branch}}
39 type=raw,value=latest,enable={{is_default_branch}}
40 type=sha,prefix=sha-,format=short
41
42 - name: login to ghcr.io
43 uses: docker/login-action@v3
44 with:
45 registry: ghcr.io
46 username: ${{ github.actor }}
47 password: ${{ secrets.GITHUB_TOKEN }}
48
49 - name: build and push
50 uses: docker/build-push-action@v6
51 with:
52 context: .
53 push: true
54 tags: ${{ steps.meta.outputs.tags }}
55 labels: ${{ steps.meta.outputs.labels }}
56 cache-from: type=gha
57 cache-to: type=gha,mode=max
58 build-args: |
59 VERSION=${{ steps.version.outputs.value }}