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-latest 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 [ "${{ github.event_name }}" = "workflow_dispatch" ]; then VERSION=${{ github.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=${{ env.GITEA_COMMIT_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-latest 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 }'