added the correct runner, and other changes

This commit is contained in:
G4MM4 2024-09-27 18:41:05 -05:00
parent e5ab07f113
commit f00413edeb
2 changed files with 84 additions and 35 deletions

View File

@ -11,18 +11,50 @@ on:
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
compile_binaries:
runs-on: ubuntu-22.04:docker://golang:latest
steps:
- name: Checkout Erigon Pulse Repo
- name: Checkout code
uses: actions/checkout@v3
- 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:
fetch-depth: 0 # Fetch all history for all tags and branches
name: binaries
path: _build/
docker_build:
needs: compile_binaries
runs-on: ubuntu-22.04:docker://docker:cli
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@ -37,46 +69,40 @@ jobs:
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 }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.prep.outputs.tags }}
tags: git.g4mm4.io/mirror/erigon-pulse:${{ gitea.ref_name }}
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
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
runs-on: ubuntu-22.04:docker://node:16-bullseye
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: binaries
path: _build/
- name: Create Release
run: |
TAG_NAME=${GITEA_REF#refs/tags/}
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 }}" \
@ -85,7 +111,24 @@ jobs:
"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)._",
"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:docker://docker:cli
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 }}

View File

@ -1 +1,7 @@
#test
The default labels are
ubuntu-latest:docker://node:16-bullseye,
ubuntu-22.04:docker://node:16-bullseye,
ubuntu-20.04:docker://node:16-bullseye,
ubuntu-18.04:docker://node:16-buster
It is a comma-separated list, and each item is a label.