-
Notifications
You must be signed in to change notification settings - Fork 12
82 lines (75 loc) · 2.37 KB
/
docker.yml
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
name: Build docker images
on:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
merge_group:
pull_request:
env:
GIT_LFS_SKIP_SMUDGE: 1
REGISTRY_URL: ghcr.io
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: Build
runs-on: ubuntu-latest
if: ${{ github.event_name == 'merge_group' || github.ref == 'refs/heads/main' }}
strategy:
fail-fast: true
matrix:
docker:
[
{ image: namada-indexer-chain, context: chain },
{ image: namada-indexer-governance, context: governance },
{ image: namada-indexer-pos, context: pos },
{ image: namada-indexer-rewards, context: rewards },
{ image: namada-indexer-seeder, context: seeder },
{ image: namada-indexer-webserver, context: webserver },
]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_URL }}/${{ matrix.docker.image }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
- name: Build and Push
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.docker.context }}/Dockerfile
push: false # ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY_URL }}/${{ matrix.docker.image }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true