fix ci, attempt 2 (#25) #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }} | |
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 |