91 lines
2.9 KiB
YAML
91 lines
2.9 KiB
YAML
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*'
|
|
|
|
env:
|
|
DOCKER_IMAGE_NAME: git.g4mm4.io/mirror/erigon-pulse
|
|
DOCKER_PLATFORMS: linux/amd64,linux/arm64
|
|
|
|
jobs:
|
|
docker_build:
|
|
runs-on: ubuntu:22.04
|
|
steps:
|
|
- name: Checkout Erigon Pulse Repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0 # Fetch all history for all tags and branches
|
|
|
|
- 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: Prepare Docker tags
|
|
id: prep
|
|
run: |
|
|
if [ "${{ gitea.event_name }}" = "workflow_dispatch" ]; then
|
|
VERSION=${{ gitea.event.inputs.version }}
|
|
elif [[ ${{ gitea.ref }} == refs/tags/* ]]; then
|
|
VERSION=${GITEA_REF#refs/tags/}
|
|
else
|
|
VERSION=$(echo ${{ gitea.sha }} | cut -c1-7)
|
|
fi
|
|
TAGS="${DOCKER_IMAGE_NAME}:${VERSION}"
|
|
if [ "$VERSION" = "latest" ]; then
|
|
TAGS="$TAGS,${DOCKER_IMAGE_NAME}:latest"
|
|
fi
|
|
echo "tags=${TAGS}" >> $GITEA_OUTPUT
|
|
echo "version=${VERSION}" >> $GITEA_OUTPUT
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: ${{ env.DOCKER_PLATFORMS }}
|
|
push: true
|
|
tags: ${{ steps.prep.outputs.tags }}
|
|
build-args: |
|
|
BUILD_DATE=${{ gitea.timestamp }}
|
|
VCS_REF=${{ gitea.sha }}
|
|
VERSION=${{ steps.prep.outputs.version }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
create_release:
|
|
needs: docker_build
|
|
if: startsWith(gitea.ref, 'refs/tags/')
|
|
runs-on: ubuntu:22.04
|
|
steps:
|
|
- name: Create Release
|
|
run: |
|
|
TAG_NAME=${GITEA_REF#refs/tags/}
|
|
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): `${{ env.DOCKER_IMAGE_NAME }}:'"$TAG_NAME"'`\n\n## Release Notes\n_Release created by Gitea Actions (pending release notes)._",
|
|
"draft": false,
|
|
"prerelease": false
|
|
}' |