Skip to content

Commit

Permalink
Establish releases (#109)
Browse files Browse the repository at this point in the history
* Establish releases

* Change the `DockerHub organization` to a variable
  • Loading branch information
bane authored Feb 14, 2024
1 parent 1510c10 commit 175b0f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,24 @@ jobs:
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Go
uses: actions/[email protected]
with:
go-version: 1.20.x

- name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
echo tag_name=${TAG} >> $GITHUB_OUTPUT
- name: Set Dockerhub organization
run: sed 's/DOCKERHUB_ORGANIZATION/${{ vars.DOCKERHUB_ORGANIZATION }}/g' .goreleaser.yml > .goreleaser.yml.tmp && mv .goreleaser.yml.tmp .goreleaser.yml
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

uses: docker/[email protected]
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Run GoReleaser
run: |
docker run \
Expand All @@ -50,13 +47,13 @@ jobs:
-e SLACK_WEBHOOK \
-e DOCKER_CONFIG \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
-v `pwd`:/go/src/${PACKAGE_NAME} \
-w /go/src/${PACKAGE_NAME} \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--rm-dist --skip-validate
--clean --skip-validate
env:
PACKAGE_NAME: github.com/Ethernal-Tech/blade
PACKAGE_NAME: github.com/${GITHUB_REPOSITORY}
GOLANG_CROSS_VERSION: v1.20.5
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.prepare.outputs.tag_name }}
SLACK_WEBHOOK: ${{ secrets.SLACK_BLADE_GITHUB_URL }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
26 changes: 13 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_name: polygon-edge
project_name: blade

release:
disable: false
Expand All @@ -17,7 +17,7 @@ builds:
- CC=o64-clang
- CXX=o64-clang++
ldflags:
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
-s -w -X 'github.com/${GITHUB_REPOSITORY}/versioning.Version=v{{ .Version }}'

- id: darwin-arm64
main: ./main.go
Expand All @@ -30,7 +30,7 @@ builds:
- CC=oa64-clang
- CXX=oa64-clang++
ldflags:
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
-s -w -X 'github.com/${GITHUB_REPOSITORY}/versioning.Version=v{{ .Version }}'

- id: linux-amd64
main: ./main.go
Expand All @@ -44,7 +44,7 @@ builds:
- 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" -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/${GITHUB_REPOSITORY}/versioning.Version=v{{ .Version }}'
tags:
- netgo
- osusergo
Expand All @@ -61,7 +61,7 @@ builds:
- 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" -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
-s -w -linkmode external -extldflags "-static" -X 'github.com/${GITHUB_REPOSITORY}/versioning.Version=v{{ .Version }}'
tags:
- netgo
- osusergo
Expand All @@ -77,7 +77,7 @@ snapshot:

dockers:
- image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
- DOCKERHUB_ORGANIZATION/{{ .ProjectName }}:{{ .Version }}-amd64
dockerfile: Dockerfile.release
use: buildx
goarch: amd64
Expand All @@ -88,7 +88,7 @@ dockers:
skip_push: false

- image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
- DOCKERHUB_ORGANIZATION/{{ .ProjectName }}:{{ .Version }}-arm64
dockerfile: Dockerfile.release
use: buildx
goarch: arm64
Expand All @@ -99,14 +99,14 @@ dockers:
skip_push: false

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

- name_template: 0xpolygon/{{ .ProjectName }}:latest
- name_template: DOCKERHUB_ORGANIZATION/{{ .ProjectName }}:latest
image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
- DOCKERHUB_ORGANIZATION/{{ .ProjectName }}:{{ .Version }}-amd64
- DOCKERHUB_ORGANIZATION/{{ .ProjectName }}:{{ .Version }}-arm64
skip_push: auto
6 changes: 3 additions & 3 deletions Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ COPY blade /usr/local/bin/

EXPOSE 8545 9632 1478

RUN addgroup -S edge \
&& adduser -S edge -G edge
RUN addgroup -S blade-group \
&& adduser -S blade -G blade-group

USER edge
USER blade

ENTRYPOINT ["blade"]

0 comments on commit 175b0f9

Please sign in to comment.