fix: add build ci to ensure build at new push

Signed-off-by: Isma <71719097+Doozers@users.noreply.github.com>
This commit is contained in:
Isma 2024-01-16 14:53:50 +01:00 committed by mortimr
parent d51414d040
commit 6c3e358833
2 changed files with 34 additions and 18 deletions

34
.github/workflows/build.yaml vendored Normal file
View file

@ -0,0 +1,34 @@
name: build
on:
push:
branches:
- "pgeth"
permissions: write-all
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "generate:build_id"
run: |
branch=${GITHUB_REF##*/}
sha=${GITHUB_SHA::8}
ts=$(date +%s)
echo "BUILD_ID=${branch}-${sha}-${ts}" >> $GITHUB_ENV
- name: "build the docker image"
run: docker build -f Dockerfile.plugins . --tag "ghcr.io/kilnfi/pgeth:${{ env.BUILD_ID }}" --tag ghcr.io/kilnfi/pgeth:latest --tag ghcr.io/kilnfi/pgeth:${GITHUB_SHA}
- name: "login to ghcr"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "push to ghcr"
run: |
docker push ghcr.io/kilnfi/pgeth:latest
docker push ghcr.io/kilnfi/pgeth:${GITHUB_SHA}

View file

@ -1,12 +1,8 @@
name: sync
on:
push:
branches:
- "pgeth"
schedule:
- cron: "0 * * * *" # every hour
workflow_dispatch:
permissions: write-all
@ -25,24 +21,10 @@ jobs:
- name: "check if diff exists"
id: diffcheck
run: echo "stdout=$(git diff master geth/master -- | wc -c)" >> $GITHUB_OUTPUT
- name: "generate:build_id"
run: |
branch=${GITHUB_REF##*/}
sha=${GITHUB_SHA::8}
ts=$(date +%s)
echo "BUILD_ID=${branch}-${sha}-${ts}" >> $GITHUB_ENV
if: github.event_name == 'push'
- name: "generate:build_id"
run: |
echo "BUILD_ID=${{ github.event.release.name }}" >> $GITHUB_ENV
if: github.event_name == 'release'
- name: "generate:build_id"
run: |
ts=$(date +%d%m%Y-%H%M%S)
echo "BUILD_ID=auto-${ts}" >> $GITHUB_ENV
if: github.event_name == 'schedule'
- name: "perform sync operations"
if: steps.diffcheck.outputs.stdout != '0'
run: |