ci: tag image on push ghcr

Signed-off-by: Isma <71719097+Doozers@users.noreply.github.com>
This commit is contained in:
Isma 2024-01-16 11:34:12 +01:00 committed by mortimr
parent 01d50e278f
commit 5c783215b8

View file

@ -25,6 +25,24 @@ 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: |
@ -35,7 +53,7 @@ jobs:
git rebase --stat geth/master
- name: "build the docker image to ensure project still builds"
if: steps.diffcheck.outputs.stdout != '0'
run: docker build -f Dockerfile.plugins . --tag ghcr.io/kilnfi/pgeth:latest --tag ghcr.io/kilnfi/pgeth:${GITHUB_SHA}
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: "push rebased master branch"
if: steps.diffcheck.outputs.stdout != '0'
run: git push origin master --force