110 lines
3.6 KiB
YAML
110 lines
3.6 KiB
YAML
name: Build and Release
|
|
|
|
on:
|
|
repository_dispatch:
|
|
types: [erigon_pulse_update]
|
|
|
|
env:
|
|
DOCKER_IMAGE_NAME: ${{ vars.GITEA_REGISTRY_URL }}/erigon-pulse:${{ github.event.client_payload.ref }}
|
|
DOCKER_PLATFORMS: linux/amd64,linux/arm64
|
|
ERIGON_REPO: ${{ vars.ERIGON_REPO_URL }}
|
|
|
|
jobs:
|
|
compile_binaries:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Erigon
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: ${{ env.ERIGON_REPO }}
|
|
ref: ${{ github.event.client_payload.ref }}
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.20'
|
|
- name: Build for Linux AMD64
|
|
run: GOOS=linux GOARCH=amd64 go build -trimpath -tags nosqlite,noboltdb -o _build/linux/erigon-amd64 ./cmd/erigon
|
|
- name: Build for Linux ARM64
|
|
run: GOOS=linux GOARCH=arm64 go build -trimpath -tags nosqlite,noboltdb -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: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Erigon
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: ${{ env.ERIGON_REPO }}
|
|
ref: ${{ github.event.client_payload.ref }}
|
|
- name: Download binaries
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: binaries
|
|
path: _build/
|
|
- 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: ${{ vars.GITEA_REGISTRY_URL }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
platforms: ${{ env.DOCKER_PLATFORMS }}
|
|
push: true
|
|
tags: ${{ env.DOCKER_IMAGE_NAME }}
|
|
build-args: |
|
|
BUILD_DATE=${{ github.event.client_payload.timestamp }}
|
|
VCS_REF=${{ github.event.client_payload.sha }}
|
|
VERSION=${{ github.event.client_payload.ref }}
|
|
|
|
release:
|
|
needs: [compile_binaries, docker_build]
|
|
if: startsWith(github.event.client_payload.ref, 'refs/tags/')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download binaries
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: binaries
|
|
path: _build/
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
_build/linux/erigon-amd64
|
|
_build/linux/erigon-arm64
|
|
body: |
|
|
**Docker Image**
|
|
- erigon multi-arch (amd64/arm64): `${{ env.DOCKER_IMAGE_NAME }}`
|
|
|
|
## Release Notes
|
|
_Release created by Gitea Actions (pending release notes)._
|
|
tag_name: ${{ github.event.client_payload.ref }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
docker_tag_latest:
|
|
needs: release
|
|
if: startsWith(github.event.client_payload.ref, 'refs/tags/')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ vars.GITEA_REGISTRY_URL }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEA_TOKEN }}
|
|
- name: Tag latest
|
|
run: |
|
|
docker buildx imagetools create -t ${{ vars.GITEA_REGISTRY_URL }}/erigon-pulse:latest ${{ env.DOCKER_IMAGE_NAME }} |