Merge pull request #1 from YYx00xZZ/feature/add-ci-build

Add build workflow
This commit is contained in:
Alexander Parvanov 2025-04-07 14:40:15 +03:00 committed by GitHub
commit 5e3e2dd68a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

37
.github/build-push.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: build docker image & push to reg
on:
pull_request:
types: [closed]
branches: [master]
paths: ["**"]
jobs:
build-and-push:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'CI:Build')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: prep tags
id: vars
run: |
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "IMAGE_NAME=${{ secrets.DOCKERHUB_USERNAME }}/geth-dev" >> $GITHUB_ENV
- name: build image
run: |
docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$COMMIT_SHA .
- name: push image
run: |
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$COMMIT_SHA