diff --git a/.github/workflows/sync-and-build-plugins.yaml b/.github/workflows/sync-and-build-plugins.yaml index b7120c1148..d830b54a29 100644 --- a/.github/workflows/sync-and-build-plugins.yaml +++ b/.github/workflows/sync-and-build-plugins.yaml @@ -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