Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goreleaser for validium node #82

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
push:
tags:
# run only against tags that follow semver (https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string)
- 'v[0-9]+.[0-9]+.[0-9]+*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.x

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --config=.goreleaser-cdk.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78 changes: 78 additions & 0 deletions .goreleaser-cdk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# .goreleaser-cdk.yaml
project_name: cdk-validium-node

release:
disable: false
draft: true
prerelease: auto

builds:
- main: ./cmd/
binary: zkevm-node
goos:
- linux
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
ldflags:
- -s -w
- -X github.com/0xPolygon/{{ .ProjectName }}.Version={{ .Version }}
- -X github.com/0xPolygon/{{ .ProjectName }}.GitRev={{ .Commit }}
- -X github.com/0xPolygon/{{ .ProjectName }}.BuildDate={{ .Date }}
- -X github.com/0xPolygon/{{ .ProjectName }}.GitBranch={{ .Branch }}

archives:
- files:
- LICENSE
- README.md

dockers:
- image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64
dockerfile: Dockerfile.release
use: buildx
goos: linux
goarch: amd64
build_flag_templates:
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
skip_push: false

- image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64
dockerfile: Dockerfile.release
use: buildx
goos: linux
goarch: arm64
build_flag_templates:
- --platform=linux/arm64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }}
- --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
skip_push: false

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

- name_template: 0xpolygon/{{ .ProjectName }}:latest
image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64
- 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64
skip_push: false
12 changes: 12 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM alpine:3.16.0

EXPOSE 8123

COPY zkevm-node /usr/local/bin

RUN addgroup -S zkevm-group \
&& adduser -S zkevm-user -G zkevm-group

USER zkevm-user

ENTRYPOINT ["zkevm-node"]
Loading