aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/docker.yaml
blob: 8761aaf662ebb22b6ccc209b8b68ac4d735d18ee (plain) (blame)
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
name: build-docker

on:
  push:
    branches: [main]
    tags:
      - 'v*'

jobs:
  publish:
    concurrency:
      group: ${{ github.ref }}-docker
      cancel-in-progress: true
    permissions:
      packages: write
      contents: read
      id-token: write

    runs-on: depot-ubuntu-24.04
    steps:
      - uses: actions/checkout@v6

      - name: Get Repo Owner
        id: get_repo_owner
        run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" > $GITHUB_ENV

      - uses: depot/setup-action@v1

      - name: Login to container Registry
        uses: docker/login-action@v3
        with:
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}
          registry: ghcr.io

      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: ghcr.io/${{ env.REPO_OWNER }}/atuin
          flavor: |
            latest=false
          tags: |
            type=ref,event=branch
            type=sha,prefix=
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}

      - name: Build and push
        uses: depot/build-push-action@v1
        with:
          push: true
          platforms: linux/amd64,linux/arm64
          file: ./Dockerfile
          context: .
          provenance: false
          build-args: |
            Version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] || 'dev' }}
            GitCommit=${{ github.sha }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}