Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
GitHub Releases (#316)
Browse files Browse the repository at this point in the history
* Release procedure.

* Setting the slack channel for releases.

* Update Dockerfile.release

Co-authored-by: Victor Castell <[email protected]>

* Update .goreleaser.yml

Co-authored-by: Victor Castell <[email protected]>

* Update .github/workflows/release.yml

Co-authored-by: Victor Castell <[email protected]>

Co-authored-by: Victor Castell <[email protected]>
  • Loading branch information
lazartravica and Victor Castell authored Jan 6, 2022
1 parent d9998a9 commit 5d71513
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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.16.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: |
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
env:
PACKAGE_NAME: github.com/0xPolygon/polygon-sdk
GOLANG_CROSS_VERSION: v1.17.2
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.prepare.outputs.tag_name }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
if: github.actor == 'lazartravica'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test-chain*
.idea

# Exclude the build .exe file from version control
dist/
main.exe
main

Expand Down
128 changes: 128 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
project_name: polygon-sdk

release:
disable: false
draft: true
prerelease: auto

builds:
- id: darwin-amd64
main: ./main.go
binary: polygon-sdk
goos:
- darwin
goarch:
- amd64
env:
- CC=o64-clang
- CXX=o64-clang++
ldflags:
-s -w

- id: darwin-arm64
main: ./main.go
binary: polygon-sdk
goos:
- darwin
goarch:
- arm64
env:
- CC=oa64-clang
- CXX=oa64-clang++
ldflags:
-s -w

- id: linux-amd64
main: ./main.go
binary: polygon-sdk
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: ./main.go
binary: polygon-sdk
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 SDK Team <[email protected]>
# description: A Framework for Building Ethereum-compatible Blockchain Networks
# license: GPLv3 LGPLv3
#
# formats:
# - apk
# - deb
# - rpm
#
# contents:
# - src: polygon-sdk.service
# dst: /lib/systemd/system/polygon-sdk.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: false

- image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
dockerfile: Dockerfile.release
use: buildx
goarch: arm64
ids:
- linux-arm64
build_flag_templates:
- --platform=linux/arm64
skip_push: false

docker_manifests:
- name_template: 0xpolygon/{{ .ProjectName }}:{{ .Version }}
image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
skip_push: false

- name_template: 0xpolygon/{{ .ProjectName }}:latest
image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
skip_push: false

announce:
slack:
enabled: true
# The name of the channel that the user selected as a destination for webhook messages.
channel: "{{ .Env.SLACK_CHANNEL }}"
10 changes: 10 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine:3.14

RUN set -x \
&& apk add --update --no-cache \
ca-certificates \
&& rm -rf /var/cache/apk/*
COPY polygon-sdk /usr/local/bin/

EXPOSE 8545 9632 1478
ENTRYPOINT ["polygon-sdk"]

0 comments on commit 5d71513

Please sign in to comment.