-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,504 additions
and
1,075 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
build/_workspace | ||
build/_bin | ||
tests/testdata | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,138 +8,96 @@ on: | |
jobs: | ||
build: | ||
name: Build | ||
strategy: | ||
matrix: | ||
os: [linux] | ||
arch: [amd64, arm64] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up a Git safe directory | ||
run: git config --global --add safe.directory ${{ github.workspace }} | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Build Binary - ${{ matrix.os }} ${{ matrix.arch }} | ||
if: matrix.arch == 'amd64' | ||
run: | | ||
docker run --rm -t \ | ||
-v ${{ github.workspace }}:${{ github.workspace }} \ | ||
-w ${{ github.workspace }} \ | ||
-e GOOS=${{ matrix.os }} \ | ||
-e GOARCH=${{ matrix.arch }} \ | ||
golang:1.20.14-bookworm sh -c "git config --global --add safe.directory ${{ github.workspace }} && make geth" | ||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build Binary - ${{ matrix.os }} ${{ matrix.arch }} | ||
if: matrix.arch == 'arm64' | ||
run: | | ||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
docker run --rm -t \ | ||
-v ${{ github.workspace }}:${{ github.workspace }} \ | ||
-w ${{ github.workspace }} \ | ||
-e GOOS=${{ matrix.os }} \ | ||
-e GOARCH=${{ matrix.arch }} \ | ||
arm64v8/golang:1.20.14-bookworm sh -c "git config --global --add safe.directory ${{ github.workspace }} && make geth" | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Cache Docker Layers | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx | ||
restore-keys: ${{ runner.os }}-buildx- | ||
|
||
- name: Build and Push | ||
uses: docker/bake-action@v4 | ||
env: | ||
REGISTRY: ghcr.io | ||
REPOSITORY: ${{ github.repository }} | ||
GIT_COMMIT: ${{ github.sha }} | ||
GIT_VERSION: ${{ github.ref_name }} | ||
IMAGE_TAGS: ${{ github.ref_name }} | ||
with: | ||
files: docker-bake.hcl | ||
push: true | ||
set: | | ||
*.platform=linux/amd64,linux/arm64 | ||
*.cache-from=type=local,src=/tmp/.buildx-cache | ||
*.cache-to=type=local,dest=/tmp/.buildx-cache,mode=max | ||
binaries.output=type=local,dest=./binaries | ||
- name: Check version label | ||
if: matrix.arch == 'amd64' | ||
run: './build/bin/geth version | grep -q "Version: $(echo ${{ github.ref_name }} | cut -c 2-10)"' | ||
run: 'binaries/linux_amd64/geth version | grep -q "Version: $(echo ${{ github.ref_name }} | cut -c 2-10)"' | ||
|
||
- name: Compress Binary | ||
run: zip -j geth-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}.zip ./build/bin/geth | ||
- name: Compress Binaries | ||
run: | | ||
(cd binaries/linux_amd64 && zip -q - geth) > geth-${{ github.ref_name }}-linux-amd64.zip | ||
(cd binaries/linux_arm64 && zip -q - geth) > geth-${{ github.ref_name }}-linux-arm64.zip | ||
- name: Create genesis.zip | ||
run: zip -r genesis.zip genesis | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v2 | ||
- name: Create setup.sh | ||
run: | | ||
sed -e 's#__REPOSITORY__#${{ github.repository }}#' .github/setup_template.sh | \ | ||
sed -e 's#__RELEASE__#${{ github.ref_name }}#' > setup.sh | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ github.ref_name }} | ||
path: geth-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.arch }}.zip | ||
path: | | ||
geth-*.zip | ||
genesis.zip | ||
setup.sh | ||
release: | ||
name: Release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download Artifact | ||
uses: actions/download-artifact@v2 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ github.ref_name }} | ||
path: artifacts | ||
|
||
- name: Archive genesis.json | ||
run: zip -r genesis.zip genesis | ||
|
||
- name: Create setup.sh | ||
run: | | ||
sed -e 's#__REPOSITORY__#${{ github.repository }}#' .github/setup_template.sh | \ | ||
sed -e 's#__RELEASE__#${{ github.ref_name }}#' > setup.sh | ||
- name: Create sha256sums.txt | ||
run: | | ||
sha256sum genesis.zip > sha256sums.txt | ||
sha256sum setup.sh >> sha256sums.txt | ||
(cd artifacts && sha256sum *) >> sha256sums.txt | ||
run: (cd artifacts && sha256sum *) > sha256sums.txt | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_name: ${{ github.ref_name }} | ||
release_name: Release ${{ github.ref_name }} | ||
name: Release ${{ github.ref_name }} | ||
draft: true | ||
|
||
- name: Upload Asset - Linux amd64 | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: artifacts/geth-${{ github.ref_name }}-linux-amd64.zip | ||
asset_name: geth-${{ github.ref_name }}-linux-amd64.zip | ||
asset_content_type: application/zip | ||
|
||
- name: Upload Asset - Linux arm64 | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: artifacts/geth-${{ github.ref_name }}-linux-arm64.zip | ||
asset_name: geth-${{ github.ref_name }}-linux-arm64.zip | ||
asset_content_type: application/zip | ||
|
||
- name: Upload Asset - genesis.zip | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: genesis.zip | ||
asset_name: genesis.zip | ||
asset_content_type: application/zip | ||
|
||
- name: Upload Asset - setup.sh | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: setup.sh | ||
asset_name: setup.sh | ||
asset_content_type: text/plain | ||
|
||
- name: Upload Asset - sha256sums.txt | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: sha256sums.txt | ||
asset_name: sha256sums.txt | ||
asset_content_type: text/plain | ||
files: | | ||
artifacts/* | ||
sha256sums.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.