Skip to content

Refactor facilitator v2 account (#142) #247

Refactor facilitator v2 account (#142)

Refactor facilitator v2 account (#142) #247

name: Build and Push Facilitator Docker Image
on:
push:
branches: [main]
paths:
- 'facilitator/**'
- 'typescript/packages/**'
- '.github/workflows/docker-facilitator.yml'
# Note: x402 packages installed via npm alias, no need to monitor deps/x402
pull_request:
branches: [main]
paths:
- 'facilitator/**'
- 'typescript/packages/**'
- '.github/workflows/docker-facilitator.yml'
env:
REGISTRY: ghcr.io
IMAGE_NAME: nuwa-protocol/facilitator
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr,prefix=pr-
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./facilitator/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
- name: Image digest
if: github.event_name != 'pull_request'
run: echo ${{ steps.build.outputs.digest }}