Add build workflow

This commit is contained in:
YYx00xZZ 2025-04-07 14:37:36 +03:00
parent 29c37eba79
commit 5508c84690

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