go-ethereum/.github/workflows/build-and-push.yml
2025-02-23 14:08:40 +02:00

46 lines
1.4 KiB
YAML

name: Build and Push go-ethereum Image
on:
pull_request:
types:
- closed
branches:
- main
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch PR labels
id: get-labels
run: |
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name' || echo "")
echo "PR_LABELS=${LABELS}" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check if PR has CI:Build label
if: contains(env.PR_LABELS, 'CI:Build')
run: echo "CI:Build label found, proceeding with build."
- name: Set up Docker Buildx
if: contains(env.PR_LABELS, 'CI:Build')
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: contains(env.PR_LABELS, 'CI:Build')
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
if: contains(env.PR_LABELS, 'CI:Build')
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/go-ethereum:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/go-ethereum:latest