Skip to content

Build release v1.3.0-beta1 from branch main by @blxdyx #91

Build release v1.3.0-beta1 from branch main by @blxdyx

Build release v1.3.0-beta1 from branch main by @blxdyx #91

Workflow file for this run

name: Release
run-name: Build release ${{ inputs.release_version}} from branch ${{ inputs.checkout_ref }} by @${{ github.actor }}
env:
APPLICATION: "bsc-erigon"
APPLICATION_VERSION: "Erigon3"
TEST_TRACKING_TIME_SECONDS: 7200 # 2 hours
TEST_TOTAL_TIME_SECONDS: 432000 # 5 days
TEST_CHAIN: "bsc"
BUILDER_IMAGE: "golang:1.22-bookworm"
DOCKER_BASE_IMAGE: "debian:12.8-slim"
APP_REPO: "node-real/bsc-erigon"
PACKAGE: "github.com/erigontech/erigon"
DOCKERHUB_REPOSITORY: "ghcr.io/node-real/bsc-erigon"
DOCKERFILE_PATH: "Dockerfile.release"
LABEL_DESCRIPTION: "Erigon is an implementation of Ethereum (execution layer with embeddable consensus layer), on the efficiency frontier. Archive Node by default."
on:
workflow_dispatch:
inputs:
checkout_ref:
required: true
type: string
default: 'main'
description: 'The branch to checkout and build artifacts from. By default "main".'
release_version:
required: true
type: string
description: 'Release version number (Pattern - v#.#.# , f.e. v2.60.1 or v3.0.0 or v3.0.0-alpha1 for pre-releases. Use prefix "v".)'
perform_release:
required: false
type: boolean
default: false
description: 'perform_release: when set then all artifacts will be published and the DRAFT of the release notes will be created.'
publish_latest_tag:
required: false
type: boolean
default: false
description: 'publish_latest_tag: when set then docker image with tag :latest will be also published'
jobs:
build-release:
runs-on: ubuntu-latest
#runs-on: ubuntu-latest-devops-xxlarge
timeout-minutes: 75
name: Create git tag, build and publish Release Artifacts
outputs:
commit-id: ${{ steps.getCommitId.outputs.id }}
short-commit-id: ${{ steps.getCommitId.outputs.short_commit_id }}
application: ${{ env.APPLICATION }}
parsed-version: ${{ steps.getCommitId.outputs.parsed_version}}
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: 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
id: getCommitId
run: |
mkdir $GITHUB_WORKSPACE/build-arm64 $GITHUB_WORKSPACE/build-amd64 $GITHUB_WORKSPACE/build-amd64v2
echo "id=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "short_commit_id=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
echo "parsed_version=$(echo ${{ inputs.release_version }} | sed -e 's/^v//g')" >> $GITHUB_OUTPUT
echo "week_of_the_year=$(/bin/date -u "+%Y-%W")" >> $GITHUB_OUTPUT
- name: ghcr-login
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 ## v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf ## v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db ## v3.6.1
- name: Setup GO build and pkg cache for one week only
id: cache
uses: actions/cache@v4
with:
key: cache-year-week-${{ steps.getCommitId.outputs.week_of_the_year }}-go.mod-hash:${{ hashFiles('erigon/go.mod') }}
path: |
~/go/pkg
~/.cache
- name: Build for linux/arm64
run: >
docker run --platform linux/arm64
--rm
-v $(pwd)/erigon:/erigon:ro
-v ${GITHUB_WORKSPACE}/build-arm64:/erigon-build
-v ${HOME}/.cache:/root/.cache
-v ${HOME}/go/pkg/mod:/go/pkg/mod
-w /erigon --entrypoint /bin/bash
${{ env.BUILDER_IMAGE }}
-c "git config --global --add safe.directory /erigon;
make GOARCH=arm64 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb,nosilkworm
erigon downloader devnet evm caplin diag integration rpcdaemon sentry txpool"
## temporary disable silkworm in 3.x.x
- name: Build for linux/amd64 (with nosilkworm tag)
run: >
docker run --platform linux/amd64
--rm
-v $(pwd)/erigon:/erigon:ro
-v ${GITHUB_WORKSPACE}/build-amd64:/erigon-build
-v ${HOME}/.cache:/root/.cache
-v ${HOME}/go/pkg/mod:/go/pkg/mod
-w /erigon --entrypoint /bin/bash
${{ env.BUILDER_IMAGE }}
-c "git config --global --add safe.directory /erigon;
make GOARCH=amd64 GOAMD64=v1 GOAMD64_VERSION=v1 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb,nosilkworm
erigon downloader devnet evm caplin diag integration rpcdaemon sentry txpool;
if [ ${WITH_SILKWORM} ]; then find / -name libsilkworm_capi.so -exec install {} /erigon-build \; ; fi;"
## temporary disable silkworm in 3.x.x
- name: Build for linux/amd64/v2 (with nosilkworm tag)
run: >
docker run --platform linux/amd64/v2
--rm
-v $(pwd)/erigon:/erigon:ro
-v ${GITHUB_WORKSPACE}/build-amd64v2:/erigon-build
-v ${HOME}/.cache:/root/.cache
-v ${HOME}/go/pkg/mod:/go/pkg/mod
-w /erigon --entrypoint /bin/bash
${{ env.BUILDER_IMAGE }}
-c "git config --global --add safe.directory /erigon;
make GOARCH=amd64 GOAMD64=v2 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb,nosilkworm
erigon downloader devnet evm caplin diag integration rpcdaemon sentry txpool;
if [ ${WITH_SILKWORM} ]; then find / -name libsilkworm_capi.so -exec install {} /erigon-build \; ; fi;"
- name: Create archives and checksums
env:
RELEASE_VERSION: ${{ inputs.release_version }}
run: |
cd ${GITHUB_WORKSPACE}
mkdir $GITHUB_WORKSPACE/release
for dir in build-*; do
cd $dir
echo Current directory is $(pwd) . Checksum file and archive will be created for this directory
sha256sum * > checksums.txt
tar czvf $GITHUB_WORKSPACE/release/${APPLICATION}_${RELEASE_VERSION}_linux_$(echo $dir | sed 's,build-,,').tar.gz \
--transform "s,^./,${APPLICATION}_${RELEASE_VERSION}_linux_$(echo $dir | sed 's,build-,,')/," .
cd -
done
cd $GITHUB_WORKSPACE/release
sha256sum * > ${APPLICATION}_${RELEASE_VERSION}_checksums.txt
echo Content of release directory:
find . -type f -ls
- name: Upload artifact -- linux/arm64
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_arm64.tar.gz
path: ${{ github.workspace }}/release/${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_arm64.tar.gz
retention-days: 3
compression-level: 0
if-no-files-found: error
- name: Upload artifact -- linux/amd64
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64.tar.gz
path: ${{ github.workspace }}/release/${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64.tar.gz
retention-days: 3
compression-level: 0
if-no-files-found: error
- name: Upload artifact -- linux/amd64/v2
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a ## v4.3.6
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64v2.tar.gz
path: ${{ github.workspace }}/release/${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64v2.tar.gz
retention-days: 3
compression-level: 0
if-no-files-found: error
# test-release:
# name: test on ${{ matrix.id }}
# runs-on: [ self-hosted, Release, "${{ matrix.runner-arch }}" ]
# timeout-minutes: 7200 # 5 days
# needs: [ build-release ]
# strategy:
# matrix:
# include:
# - id: linux/amd64
# runner-arch: X64
# artifact: linux_amd64
# - id: linux/arm64
# runner-arch: ARM64
# artifact: linux_arm64
#
# steps:
#
# - name: Cleanup working directory
# run: rm -drfv *
#
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: '3.12'
#
# - name: Download artifact ${{ env.APPLICATION }}_${{ inputs.release_version }}_${{ matrix.artifact }}.tar.gz
# uses: actions/download-artifact@v4
# with:
# name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_${{ matrix.artifact }}.tar.gz
# path: .
#
# - name: Extract artifact ${{ env.APPLICATION }}_${{ inputs.release_version }}_${{ matrix.artifact }}.tar.gz
# run: |
# pwd
# ls -l ${{ env.APPLICATION }}_${{ inputs.release_version }}_${{ matrix.artifact }}.tar.gz
# tar xzvf ${{ env.APPLICATION }}_${{ inputs.release_version }}_${{ matrix.artifact }}.tar.gz
# ls -lR
# - name: Fast checkout git repository erigontech/erigon-qa
# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 ## 4.1.7 release
# with:
# token: ${{ secrets.ORG_GITHUB_ERIGONTECH_ERIGON_QA_READ }}
# repository: erigontech/erigon-qa
# fetch-depth: 1
# ref: main
# path: erigon-qa
#
# - name: Checkout QA Tests Repository & Install Requirements
# run: |
# cd ./erigon-qa/test_system
# pwd
# ls -lao
# pip3 install -r requirements.txt
# ln -s $(pwd)/base_library $(pwd)/qa-tests/tip-tracking/base_library
# echo "DEBUG -- content of directory $(pwd) :"
# ls -l
# echo "DEBUG -- content of directory $(pwd)/qa-tests/tip-tracking/"
# ls -l $(pwd)/qa-tests/tip-tracking/
# echo "DEBUG -- content of directory GITHUB_WORKSPACE ${GITHUB_WORKSPACE} :"
# ls -l ${GITHUB_WORKSPACE}
# echo "DEBUG -- end."
# rm -rf ${RUNNER_WORKSPACE}/erigon-data || true
# mkdir ${RUNNER_WORKSPACE}/erigon-data
# # Run Erigon, wait sync and check ability to maintain sync
# python3 qa-tests/tip-tracking/run_and_check_tip_tracking.py \
# ${GITHUB_WORKSPACE}/${{ env.APPLICATION }}_${{ inputs.release_version }}_${{ matrix.artifact }} \
# ${RUNNER_WORKSPACE}/erigon-data ${{ env.TEST_TRACKING_TIME_SECONDS }} ${{ env.TEST_TOTAL_TIME_SECONDS }} ${{ env.APPLICATION_VERSION }} ${{ env.TEST_CHAIN }}
# # Capture monitoring script exit status
# test_exit_status=$?
# # Save the subsection reached status
# echo "::set-output name=test_executed::true"
# # Check test runner script exit status
# if [ $test_exit_status -eq 0 ]; then
# echo "Tests completed successfully"
# echo "TEST_RESULT=success" >> "$GITHUB_OUTPUT"
# else
# echo "Error detected during tests"
# echo "TEST_RESULT=failure" >> "$GITHUB_OUTPUT"
# fi
#
# - name: Cleanup working directory
# run: rm -drfv *
build-debian-pkg:
name: Debian packages
needs: [ build-release ]
uses: erigontech/erigon/.github/workflows/reusable-release-build-debian-pkg.yml@main
with:
application: ${{ needs.build-release.outputs.application }}
version: ${{ needs.build-release.outputs.parsed-version }}
publish-docker-image:
needs: [ build-release ]
runs-on: ubuntu-latest
timeout-minutes: 30
name: Docker image
steps:
- name: Fast checkout just ${{ env.DOCKERFILE_PATH }} from git repository ${{ env.APP_REPO }}
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 ## 4.1.7 release
with:
repository: ${{ env.APP_REPO }}
sparse-checkout: ${{ env.DOCKERFILE_PATH }}
sparse-checkout-cone-mode: false
ref: ${{ needs.build-release.outputs.commit-id }}
- name: Download arm64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_arm64.tar.gz
- name: Download amd64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64.tar.gz
- name: Download amd64v2 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64v2.tar.gz
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf ## v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db ## v3.6.1
- name: ghcr-login
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 ## v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push multi-platform docker images (${{ env.BUILD_VERSION }} and maybe latest) in case perform_release is true
if: ${{ inputs.perform_release }}
env:
BUILD_VERSION: ${{ inputs.release_version }}
DOCKER_URL: ${{ env.DOCKERHUB_REPOSITORY }}
DOCKER_PUBLISH_LATEST_CONDITION: ${{ inputs.publish_latest_tag && format('--tag {0}:latest ',env.DOCKERHUB_REPOSITORY) || '' }}
run: |
pwd
find . -ls
docker buildx build \
--file ${{ env.DOCKERFILE_PATH }} \
--build-arg RELEASE_DOCKER_BASE_IMAGE=${{ env.DOCKER_BASE_IMAGE }} \
--build-arg VERSION=${{ env.BUILD_VERSION }} \
--build-arg APPLICATION=${{ env.APPLICATION }} \
--tag ${{ env.DOCKER_URL }}:${{ env.BUILD_VERSION }} \
--target release \
--attest type=provenance,mode=max \
--sbom=true \
${{ env.DOCKER_PUBLISH_LATEST_CONDITION }} \
--label org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--label org.opencontainers.image.authors="https://github.com/erigontech/erigon/graphs/contributors" \
--label org.opencontainers.image.url="https://github.com/erigontech/erigon/blob/${{ inputs.checkout_ref }}/${{ env.DOCKERFILE_PATH }}" \
--label org.opencontainers.image.documentation="https://github.com/erigontech/erigon/blob/${{ inputs.checkout_ref }}/${{ env.DOCKERFILE_PATH }}" \
--label org.opencontainers.image.source="https://github.com/erigontech/erigon/blob/${{ inputs.checkout_ref }}/${{ env.DOCKERFILE_PATH }}" \
--label org.opencontainers.image.version=${{ inputs.release_version }} \
--label org.opencontainers.image.revision=${{ needs.build-release.outputs.commit-id }} \
--label org.opencontainers.image.vcs-ref-short=${{ needs.build-release.outputs.short-commit-id }} \
--label org.opencontainers.image.vendor="${{ github.repository_owner }}" \
--label org.opencontainers.image.description="${{ env.LABEL_DESCRIPTION }}" \
--label org.opencontainers.image.base.name="${{ env.DOCKER_BASE_IMAGE }}" \
--push \
--platform linux/amd64,linux/amd64/v2,linux/arm64 .
publish-release:
needs: [ build-debian-pkg, publish-docker-image, build-release ]
runs-on: ubuntu-latest
timeout-minutes: 15
name: Publish release notes
steps:
- name: Download linux/arm64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_arm64.tar.gz
path: dist/
- name: Download linux/amd64 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64.tar.gz
path: dist/
- name: Download linux/amd64v2 artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.APPLICATION }}_${{ inputs.release_version }}_linux_amd64v2.tar.gz
path: dist/
- name: Download arm64 debian package
uses: actions/download-artifact@v4
with:
name: ${{ env.APPLICATION }}_${{ needs.build-release.outputs.parsed-version }}_arm64.deb
path: dist/
- name: Download amd64 debian package
uses: actions/download-artifact@v4
with:
name: ${{ env.APPLICATION }}_${{ needs.build-release.outputs.parsed-version }}_amd64.deb
path: dist/
- name: Publish draft of the Release notes with assets in case perform_release is set
if: ${{ inputs.perform_release }}
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
DOCKER_TAGS: ${{ env.DOCKERHUB_REPOSITORY }}:${{ inputs.release_version }}
GITHUB_RELEASE_TARGET: ${{ inputs.checkout_ref }}
run: |
cd dist
sha256sum *.tar.gz *.deb > ${HOME}/${{ env.APPLICATION }}_${{ inputs.release_version }}_checksums.txt
gh release create \
--generate-notes \
--target ${GITHUB_RELEASE_TARGET} \
--draft=true \
--title "${{ inputs.release_version }}" \
--notes "**Improvements:**<br>- ...coming soon <br><br>**Bugfixes:**<br><br>- ...coming soon<br><br>**Docker images:**<br><br>Docker image released:<br> ${{ env.DOCKER_TAGS }}<br><br>... coming soon<br>" \
"${{ inputs.release_version }}" \
*.tar.gz *.deb ${HOME}/${{ 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: [ publish-release, 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 }}