mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Release multi-platform with goreleaser
Packages, docker images CI automated
This commit is contained in:
parent
1cd6c844aa
commit
7b6bab4986
9 changed files with 233 additions and 118 deletions
26
.github/workflows/dockerimage-latest.yml
vendored
26
.github/workflows/dockerimage-latest.yml
vendored
|
|
@ -1,26 +0,0 @@
|
|||
name: Docker Images For Latest Branches
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build docker image
|
||||
env:
|
||||
DOCKERHUB: ${{ secrets.DOCKERHUB }}
|
||||
DOCKERHUB_KEY: ${{ secrets.DOCKERHUB_KEY }}
|
||||
run: |
|
||||
set -x
|
||||
ls -l
|
||||
echo "Docker login"
|
||||
docker login -u $DOCKERHUB -p $DOCKERHUB_KEY
|
||||
echo "Running build"
|
||||
docker build -t maticnetwork/bor:${GITHUB_REF/refs\/heads\//} .
|
||||
echo "Pushing image"
|
||||
docker push maticnetwork/bor:${GITHUB_REF/refs\/heads\//}
|
||||
echo "Done"
|
||||
25
.github/workflows/dockerimage.yml
vendored
25
.github/workflows/dockerimage.yml
vendored
|
|
@ -1,25 +0,0 @@
|
|||
name: Bor Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build the Bor Docker image
|
||||
env:
|
||||
DOCKERHUB: ${{ secrets.DOCKERHUB }}
|
||||
DOCKERHUB_KEY: ${{ secrets.DOCKERHUB_KEY }}
|
||||
run: |
|
||||
ls -l
|
||||
echo "Docker login"
|
||||
docker login -u $DOCKERHUB -p $DOCKERHUB_KEY
|
||||
echo "running build"
|
||||
docker build -t maticnetwork/bor:${GITHUB_REF/refs\/tags\//} .
|
||||
echo "pushing image"
|
||||
docker push maticnetwork/bor:${GITHUB_REF/refs\/tags\//}
|
||||
echo "DONE!"
|
||||
67
.github/workflows/linuxpackage.yml
vendored
67
.github/workflows/linuxpackage.yml
vendored
|
|
@ -1,67 +0,0 @@
|
|||
name: Linux package
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.17
|
||||
|
||||
- name: Set up Ruby 2.6
|
||||
uses: actions/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
|
||||
- name: Retrieve release version
|
||||
run: |
|
||||
echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
set -x
|
||||
|
||||
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
||||
|
||||
sudo apt-get -yqq install libpq-dev build-essential
|
||||
gem install --no-document fpm
|
||||
fpm --version
|
||||
|
||||
make bor-all
|
||||
|
||||
fpm -s dir -t deb --deb-user root --deb-group root -n matic-bor -v ${{ env.RELEASE_VERSION }} \
|
||||
build/bin/bor=/usr/bin/ \
|
||||
build/bin/bootnode=/usr/bin/
|
||||
|
||||
mkdir packages-v${{ env.RELEASE_VERSION }}
|
||||
|
||||
mv matic-bor_${{ env.RELEASE_VERSION }}_amd64.deb packages-v${{ env.RELEASE_VERSION }}/
|
||||
|
||||
ls packages-v${{ env.RELEASE_VERSION }}/
|
||||
|
||||
- name: S3 upload
|
||||
uses: jakejarvis/s3-sync-action@master
|
||||
with:
|
||||
args: --acl public-read
|
||||
env:
|
||||
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_REGION: "us-east-1" # optional: defaults to us-east-1
|
||||
SOURCE_DIR: "packages-v${{ env.RELEASE_VERSION }}"
|
||||
DEST_DIR: "v${{ env.RELEASE_VERSION }}"
|
||||
|
||||
- name: Slack Notification
|
||||
uses: rtCamp/action-slack-notify@v2.0.0
|
||||
env:
|
||||
SLACK_CHANNEL: code-releases
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
SLACK_TITLE: "New linux package for Bor v${{ env.RELEASE_VERSION }} just got released"
|
||||
SLACK_MESSAGE: "Package has been uploaded to S3 bucket for public use and available at https://matic-public.s3.amazonaws.com/v${{ env.RELEASE_VERSION }}/matic-bor_${{ env.RELEASE_VERSION }}_amd64.deb"
|
||||
43
.github/workflows/release.yml
vendored
Normal file
43
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- '**'
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
# to be used by fork patch-releases ^^
|
||||
- 'v*.*.*-*'
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@master
|
||||
with:
|
||||
go-version: 1.17.x
|
||||
|
||||
- name: Prepare
|
||||
id: prepare
|
||||
run: |
|
||||
TAG=${GITHUB_REF#refs/tags/}
|
||||
echo ::set-output name=tag_name::${TAG}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Run GoReleaser
|
||||
run: |
|
||||
make release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: ${{ steps.prepare.outputs.tag_name }}
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKERHUB }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_KEY }}
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -49,3 +49,5 @@ profile.cov
|
|||
**/yarn-error.log
|
||||
./test
|
||||
./bor-debug-*
|
||||
|
||||
dist
|
||||
|
|
|
|||
126
.goreleaser.yml
Normal file
126
.goreleaser.yml
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
project_name: bor
|
||||
|
||||
release:
|
||||
disable: false
|
||||
draft: true
|
||||
prerelease: auto
|
||||
|
||||
builds:
|
||||
- id: darwin-amd64
|
||||
main: ./cmd/geth
|
||||
binary: bor
|
||||
goos:
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
env:
|
||||
- CC=o64-clang
|
||||
- CXX=o64-clang++
|
||||
ldflags:
|
||||
-s -w
|
||||
|
||||
- id: darwin-arm64
|
||||
main: ./cmd/geth
|
||||
binary: bor
|
||||
goos:
|
||||
- darwin
|
||||
goarch:
|
||||
- arm64
|
||||
env:
|
||||
- CC=oa64-clang
|
||||
- CXX=oa64-clang++
|
||||
ldflags:
|
||||
-s -w
|
||||
|
||||
- id: linux-amd64
|
||||
main: ./cmd/geth
|
||||
binary: bor
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
env:
|
||||
- CC=gcc
|
||||
- CXX=g++
|
||||
ldflags:
|
||||
# We need to build a static binary because we are building in a glibc based system and running in a musl container
|
||||
-s -w -linkmode external -extldflags "-static"
|
||||
|
||||
- id: linux-arm64
|
||||
main: ./cmd/geth
|
||||
binary: bor
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- arm64
|
||||
env:
|
||||
- CC=aarch64-linux-gnu-gcc
|
||||
- CXX=aarch64-linux-gnu-g++
|
||||
ldflags:
|
||||
# We need to build a static binary because we are building in a glibc based system and running in a musl container
|
||||
-s -w -linkmode external -extldflags "-static"
|
||||
|
||||
nfpms:
|
||||
- vendor: 0xPolygon
|
||||
homepage: https://polygon.technology
|
||||
maintainer: Polygon Team <team@polygon.technology>
|
||||
description: Polygon Blockchain
|
||||
license: GPLv3 LGPLv3
|
||||
|
||||
formats:
|
||||
- apk
|
||||
- deb
|
||||
- rpm
|
||||
|
||||
contents:
|
||||
- src: builder/files/bor.service
|
||||
dst: /lib/systemd/system/bor.service
|
||||
type: config
|
||||
|
||||
overrides:
|
||||
rpm:
|
||||
replacements:
|
||||
amd64: x86_64
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}.next"
|
||||
|
||||
dockers:
|
||||
- image_templates:
|
||||
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||
dockerfile: Dockerfile.release
|
||||
use: buildx
|
||||
goarch: amd64
|
||||
ids:
|
||||
- linux-amd64
|
||||
build_flag_templates:
|
||||
- --platform=linux/amd64
|
||||
skip_push: true
|
||||
|
||||
- image_templates:
|
||||
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||
dockerfile: Dockerfile.release
|
||||
use: buildx
|
||||
goarch: arm64
|
||||
ids:
|
||||
- linux-arm64
|
||||
build_flag_templates:
|
||||
- --platform=linux/arm64
|
||||
skip_push: true
|
||||
|
||||
docker_manifests:
|
||||
- name_template: 0xpolygon/{{ .ProjectName }}:{{ .Version }}
|
||||
image_templates:
|
||||
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||
|
||||
- name_template: 0xpolygon/{{ .ProjectName }}:latest
|
||||
image_templates:
|
||||
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
|
||||
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
|
||||
|
||||
announce:
|
||||
slack:
|
||||
enabled: true
|
||||
# The name of the channel that the user selected as a destination for webhook messages.
|
||||
channel: '#code-releases'
|
||||
10
Dockerfile.release
Normal file
10
Dockerfile.release
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
FROM alpine:3.14
|
||||
|
||||
RUN set -x \
|
||||
&& apk add --update --no-cache \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
COPY bor /usr/local/bin/
|
||||
|
||||
EXPOSE 8545 8546 8547 30303 30303/udp
|
||||
ENTRYPOINT ["bor"]
|
||||
34
Makefile
34
Makefile
|
|
@ -163,3 +163,37 @@ geth-windows-amd64:
|
|||
$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth
|
||||
@echo "Windows amd64 cross compilation done:"
|
||||
@ls -ld $(GOBIN)/geth-windows-* | grep amd64
|
||||
|
||||
PACKAGE_NAME := github.com/maticnetwork/bor
|
||||
GOLANG_CROSS_VERSION ?= v1.17.2
|
||||
|
||||
.PHONY: release-dry-run
|
||||
release-dry-run:
|
||||
@docker run \
|
||||
--rm \
|
||||
--privileged \
|
||||
-e CGO_ENABLED=1 \
|
||||
-e GITHUB_TOKEN \
|
||||
-e DOCKER_USERNAME \
|
||||
-e DOCKER_PASSWORD \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v `pwd`:/go/src/$(PACKAGE_NAME) \
|
||||
-w /go/src/$(PACKAGE_NAME) \
|
||||
ghcr.io/troian/golang-cross:${GOLANG_CROSS_VERSION} \
|
||||
--rm-dist --skip-validate --skip-publish
|
||||
|
||||
.PHONY: release
|
||||
release:
|
||||
@docker run \
|
||||
--rm \
|
||||
--privileged \
|
||||
-e CGO_ENABLED=1 \
|
||||
-e GITHUB_TOKEN \
|
||||
-e DOCKER_USERNAME \
|
||||
-e DOCKER_PASSWORD \
|
||||
-e SLACK_WEBHOOK \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v `pwd`:/go/src/$(PACKAGE_NAME) \
|
||||
-w /go/src/$(PACKAGE_NAME) \
|
||||
ghcr.io/troian/golang-cross:${GOLANG_CROSS_VERSION} \
|
||||
--rm-dist --skip-validate
|
||||
|
|
|
|||
18
builder/files/bor.service
Normal file
18
builder/files/bor.service
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[Unit]
|
||||
Description=bor
|
||||
StartLimitIntervalSec=500
|
||||
StartLimitBurst=5
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
WorkingDirectory=$NODE_DIR
|
||||
EnvironmentFile=/etc/matic/metadata
|
||||
ExecStart=/usr/local/bin/bor $VALIDATOR_ADDRESS
|
||||
Type=simple
|
||||
User=$USER
|
||||
KillSignal=SIGINT
|
||||
TimeoutStopSec=120
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Reference in a new issue