From 9dc3435f893801cbff5d2cec74f66ec97d4da74c Mon Sep 17 00:00:00 2001 From: lystopad Date: Wed, 20 Nov 2024 16:52:16 +0100 Subject: [PATCH] Cherry pick PR12658 & PR12721 form release/2.60 (#12807) --- .github/workflows/release.yml | 34 +++++++++++++++++++++++++++++++--- Makefile | 2 +- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be788a0947f..1fb53c36e71 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,10 @@ name: Release +run-name: Build release ${{ inputs.release_version }} from branch ${{ inputs.checkout_ref }} by @${{ github.actor }} env: APPLICATION: "erigon" BUILDER_IMAGE: "golang:1.22-bookworm" - DOCKER_BASE_IMAGE: "debian:12.7-slim" + DOCKER_BASE_IMAGE: "debian:12.8-slim" APP_REPO: "erigontech/erigon" PACKAGE: "github.com/erigontech/erigon" DOCKERHUB_REPOSITORY: "erigontech/erigon" @@ -43,7 +44,7 @@ jobs: name: Build Artifacts and multi-platform Docker image, publish draft of the Release Notes steps: - - name: Checkout git repository ${{ env.APP_REPO }} + - name: Checkout git repository ${{ env.APP_REPO }} reference ${{ inputs.checkout_ref }} uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 ## 4.1.7 release with: repository: ${{ env.APP_REPO }} @@ -51,14 +52,18 @@ jobs: ref: ${{ inputs.checkout_ref }} path: 'erigon' - - name: Check if tag ${{ inputs.release_version }} already exists in case perform_release is set. + - name: Check if tag ${{ inputs.release_version }} already exists and create it in case perform_release is set. if: ${{ (inputs.perform_release) && (inputs.release_version != '') }} run: | + cd erigon if git ls-remote --exit-code --quiet --tags origin '${{ inputs.release_version }}'; then echo "ERROR: tag ${{ inputs.release_version }} exists and workflow is performing release. Exit." exit 1 else echo "OK: tag ${{ inputs.release_version }} does not exists. Proceeding." + git tag ${{ inputs.release_version }} + git push origin ${{ inputs.release_version }} + echo; echo "Git TAG ${{ inputs.release_version }} created and pushed." fi - name: Run some commands, get commit id @@ -230,3 +235,26 @@ jobs: --notes "**Improvements:**
- ...coming soon

**Bugfixes:**

- ...coming soon

**Docker images:**

Docker image released:
${{ env.DOCKER_TAGS }}

... coming soon
" \ ${{ inputs.release_version }} \ *.tar.gz ${{ env.APPLICATION }}_${{ inputs.release_version }}_checksums.txt + + In-case-of-failure: + name: "In case of failure: remove remote git tag pointing to the new version." + needs: [ build-release ] + if: always() && !contains(needs.build-release.result, 'success') + runs-on: ubuntu-22.04 + + steps: + - name: Checkout git repository ${{ env.APP_REPO }} reference ${{ inputs.checkout_ref }} + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 ## 4.1.7 release + with: + repository: ${{ env.APP_REPO }} + fetch-depth: 0 + ref: ${{ inputs.checkout_ref }} + path: 'erigon' + + - name: Rollback - remove git tag ${{ inputs.release_version }} + if: ${{ (inputs.perform_release) && (inputs.release_version != '') }} + run: | + cd erigon + git push -d origin ${{ inputs.release_version }} + + \ No newline at end of file diff --git a/Makefile b/Makefile index 2a2273febc2..71d4c8d1619 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ DOCKER := $(shell command -v docker 2> /dev/null) GIT_COMMIT ?= $(shell git rev-list -1 HEAD) GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) -GIT_TAG ?= $(shell git describe --tags '--match=v*' --dirty) +GIT_TAG ?= $(shell git describe --tags '--match=*.*.*' --abbrev=7 --dirty) ERIGON_USER ?= erigon # if using volume-mounting data dir, then must exist on host OS DOCKER_UID ?= $(shell id -u)