name: Build and Release Erigon Pulse on: workflow_dispatch: inputs: version: description: 'Version to build (e.g., v1.0.0, latest)' required: true default: 'latest' push: tags: - 'v*' jobs: compile_binaries: runs-on: ubuntu-22.04 steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v4 with: go-version: '1.20' - name: Set COMPILE_JOB_ID run: echo "COMPILE_JOB_ID=${{ gitea.job_id }}" >> $GITEA_OUTPUT - name: Build for Linux AMD64 env: CGO_CFLAGS: >- -DMDBX_FORCE_ASSERTIONS=0 -O -D__BLST_PORTABLE__ -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-prototypes GO_FLAGS: -trimpath -tags nosqlite,noboltdb run: | GOOS=linux GOARCH=amd64 go build $GO_FLAGS \ -o _build/linux/erigon-amd64 ./cmd/erigon - name: Build for Linux ARM64 env: CGO_CFLAGS: >- -DMDBX_FORCE_ASSERTIONS=0 -O -D__BLST_PORTABLE__ -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-prototypes GO_FLAGS: -trimpath -tags nosqlite,noboltdb run: | GOOS=linux GOARCH=arm64 go build $GO_FLAGS \ -o _build/linux/erigon-arm64 ./cmd/erigon - name: Upload artifacts uses: actions/upload-artifact@v3 with: name: binaries path: _build/ docker_build: needs: compile_binaries runs-on: gitea/runner-images:ubuntu-22.04 steps: - name: Checkout code uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Gitea Container Registry uses: docker/login-action@v2 with: registry: git.g4mm4.io username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.ACCESS_TOKEN }} - name: Build and push uses: docker/build-push-action@v4 with: context: . file: ./Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: git.g4mm4.io/mirror/erigon-pulse:${{ gitea.ref_name }} build-args: | BUILD_DATE=${{ gitea.timestamp }} VCS_REF=${{ gitea.sha }} VERSION=${{ gitea.ref_name }} provenance: false - name: Inspect manifest run: | docker manifest inspect git.g4mm4.io/mirror/erigon-pulse:${{ gitea.ref_name }} create_release: needs: docker_build if: startsWith(gitea.ref, 'refs/tags/') runs-on: ubuntu-22.04 steps: - name: Download artifacts uses: actions/download-artifact@v3 with: name: binaries path: _build/ - name: Create Release run: | TAG_NAME=${{ gitea.ref_name }} COMPILE_JOB_ID=$(cat $GITEA_OUTPUT | grep COMPILE_JOB_ID | cut -d'=' -f2) ARTIFACT_URL="${{ gitea.server_url }}/${{ gitea.repository.full_name }}/actions/artifacts/$COMPILE_JOB_ID" curl -X POST "${{ gitea.api_url }}/repos/${{ gitea.repository.full_name }}/releases" \ -H "accept: application/json" \ -H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \ -H "Content-Type: application/json" \ -d '{ "tag_name": "'"$TAG_NAME"'", "target_commitish": "${{ gitea.sha }}", "name": "Release '"$TAG_NAME"'", "body": "**Docker Image**\n- erigon-pulse multi-arch (amd64/arm64): `git.g4mm4.io/mirror/erigon-pulse:'"$TAG_NAME"'`\n\n## Release Notes\n_Release created by pipeline (pending release notes)._", "draft": false, "prerelease": false }' docker_tag_latest: needs: create_release if: startsWith(gitea.ref, 'refs/tags/') runs-on: ubuntu-22.04 steps: - name: Login to Gitea Container Registry uses: docker/login-action@v2 with: registry: git.g4mm4.io username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.ACCESS_TOKEN }} - name: Tag latest run: | docker buildx imagetools create -t git.g4mm4.io/mirror/erigon-pulse:latest \ git.g4mm4.io/mirror/erigon-pulse:${{ gitea.ref_name }}