mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
Update build-and-push.yml
This commit is contained in:
parent
c895f6929f
commit
d1ef1a9cb2
1 changed files with 16 additions and 3 deletions
19
.github/workflows/build-and-push.yml
vendored
19
.github/workflows/build-and-push.yml
vendored
|
|
@ -8,26 +8,39 @@ on:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Build')
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Set up Docker Buildx
|
||||||
|
if: contains(env.PR_LABELS, 'CI:Build')
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
- name: Log in to Docker Hub
|
||||||
|
if: contains(env.PR_LABELS, 'CI:Build')
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
|
if: contains(env.PR_LABELS, 'CI:Build')
|
||||||
run: |
|
run: |
|
||||||
docker build -t ${{ secrets.DOCKER_USERNAME }}/go-ethereum:latest .
|
docker build -t ${{ secrets.DOCKER_USERNAME }}/go-ethereum:latest .
|
||||||
docker push ${{ secrets.DOCKER_USERNAME }}/go-ethereum:latest
|
docker push ${{ secrets.DOCKER_USERNAME }}/go-ethereum:latest
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue