Skip to content

Build image and push to ghcr.io #664

Build image and push to ghcr.io

Build image and push to ghcr.io #664

Workflow file for this run

name: Build image and push to ghcr.io
on:
push:
branches:
- main
workflow_run:
workflows: ["Path tests"]
types:
- completed
branches:
- main
workflow_dispatch: # Manual trigger
jobs:
build-and-push:
runs-on: ubuntu-22.04
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build binaries for multiple architectures
run: make release_build_nocgo
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Metadata action
id: meta
uses: docker/metadata-action@v5
env:
DOCKER_METADATA_PR_HEAD_SHA: "true"
with:
images: |
ghcr.io/pokt-network/path
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=ref,event=tag,suffix=-rc
type=sha,format=short,suffix=-rc
type=ref,event=branch,pattern=latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
# Runtime image (multi-arch, Alpine)
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: IMAGE_TAG=${{ steps.meta.outputs.version }}
platforms: linux/amd64,linux/arm64
file: Dockerfile.release
cache-from: type=gha
cache-to: type=gha,mode=max
context: .