forked from 0xPolygonHermez/zkevm-node
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from 0xPolygon/CDK-71-introduce-goreleaser-on-…
…cdk-validum-node goreleaser for validium node
- Loading branch information
Showing
3 changed files
with
132 additions
and
0 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 |
---|---|---|
@@ -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 }} |
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -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"] |