sepolia-Add build file for sepolia (#114) #136
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [released] | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build_and_publish_docker_image: | |
runs-on: ubuntu-latest | |
env: | |
architecture: "amd64" | |
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=4" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Set up QEMU for Docker | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Check Dockerfile syntax | |
run: | | |
docker run --rm -i hadolint/hadolint < docker/Dockerfile | |
- name: Get VERSION output | |
if: github.event_name == 'release' | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT | |
- name: Login to Docker Hub for self hosted | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USER_RW }} | |
password: ${{ secrets.DOCKER_PAT_RW }} | |
- name: Build Docker Image | |
run: | | |
if [ "${{ github.event_name }}" == "release" ]; then \ | |
./gradlew -PdockerOrgName=consensys -Pdocker-platform=linux/amd64,linux/arm64 distDocker -PreleaseVersion=${{ steps.get_version.outputs.VERSION }} -PpublishDocker=true; \ | |
else \ | |
./gradlew -PdockerOrgName=consensys -Pdocker-platform=linux/amd64,linux/arm64 distDocker -PpublishDocker=true; \ | |
fi | |
- name: Verify Docker image | |
if: github.event_name == 'release' | |
id: verify | |
run: | | |
MANIFEST=$(docker manifest inspect consensys/linea-besu-package:${{ steps.get_version.outputs.VERSION }}) | |
if [ $? -eq 0 ]; then | |
echo "## Docker Image Details" > output.md | |
echo "" >> output.md | |
echo "To pull the image, use the following command:" >> output.md | |
echo "\`\`\`" >> output.md | |
echo "docker pull consensys/linea-besu-package:${{ steps.get_version.outputs.VERSION }}" >> output.md | |
echo "\`\`\`" >> output.md | |
echo "" >> output.md | |
echo "| Digest | OS | Architecture |" >> output.md | |
echo "|--------|----|--------------|" >> output.md | |
echo "$MANIFEST" | jq -r '.manifests[] | select(.platform.architecture != "unknown" and .platform.os != "unknown") | "| \(.digest) | \(.platform.os) | \(.platform.architecture) |"' >> output.md | |
else | |
echo "Docker image consensys/linea-besu-package:${{ steps.get_version.outputs.VERSION }} does not exist on Docker Hub." | |
exit 1 | |
fi | |
- name: Update Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: output.md | |
append_body: true | |
- name: Pull, Tag, and Push Docker Image as latest | |
if: github.event_name == 'release' | |
run: | | |
docker pull consensys/linea-besu-package:${{ steps.get_version.outputs.VERSION }} | |
docker buildx imagetools create \ | |
--tag consensys/linea-besu-package:latest \ | |
consensys/linea-besu-package:${{ steps.get_version.outputs.VERSION }} |