Skip to content

Update transaction value in Transfer function to maximum u64 #33

Update transaction value in Transfer function to maximum u64

Update transaction value in Transfer function to maximum u64 #33

name: Build and Push Docker Image (GHCR + Docker Hub)
on:
push:
branches: [ main ]
tags:
- 'v*'
paths:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'Dockerfile'
- '.github/workflows/docker-build-push.yml'
pull_request:
branches: [ main ]
paths:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'Dockerfile'
workflow_dispatch:
env:
# Registries
GHCR_REGISTRY: ghcr.io
DH_REGISTRY: docker.io
GHCR_IMAGE: clutchprotocol/clutch-node
DH_IMAGE: 9194010019/clutch-node
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login GHCR
- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Login Docker Hub
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.DH_REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# One metadata step generates tags for BOTH registries
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE }}
${{ env.DH_REGISTRY }}/${{ env.DH_IMAGE }}
tags: |
# sha-<short>
type=sha,format=short
# latest فقط روی برنچ پیش‌فرض (main)
type=raw,value=latest,enable={{is_default_branch}}
# اگر تگ گیت (v1.2.3) داشتی همون رو tag کن
type=ref,event=tag
- name: Build and push Docker image (both registries)
id: build
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
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
build-args: |
BUILDKIT_INLINE_CACHE=1
- name: Image digest
if: github.event_name != 'pull_request'
run: echo ${{ steps.build.outputs.digest }}
update-description:
needs: build-and-push
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.DH_IMAGE }}
readme-filepath: ./README.md