Skip to content

Commit

Permalink
release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
pkieltyka committed Feb 11, 2024
1 parent bc6801b commit f321b89
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 6 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# See documentation at https://goreleaser.com/customization/build.
project_name: czip

builds:
- id: czip-compressor
main: ./cmd/czip-compressor
binary: czip-compressor
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w -X github.com/0xsequence/czip/compressor.VERSION=v{{.Version}}

archives:
- id: czip-compressor
builds:
- czip-compressor
name_template: "{{ .Binary }}.{{ .Os }}-{{ .Arch }}"
format: binary

checksum:
name_template: "checksums.txt"

release:
footer: |
## Docker
```
$ docker pull ghcr.io/0xsequence/czip-compressor:v{{.Version}}
```
Example: `$ docker run ghcr.io/0xsequence/czip-compressor`
## Homebrew
```
$ brew tap 0xsequence/tap
$ brew install czip-compressor
$ czip-compressor
```
## Build from source
```
$ go install github.com/0xsequence/czip/cmd/czip-compressor
```
## Download binaries
macOS: [amd64](https://github.com/0xsequence/czip/releases/download/v{{.Version}}/czip-compressor.darwin-amd64), [arm64](https://github.com/0xsequence/czip/releases/download/v{{.Version}}/czip-compressor.darwin-arm64) (Apple Silicon)
Linux: [amd64](https://github.com/0xsequence/czip/releases/download/v{{.Version}}/czip-compressor.linux-amd64), [arm64](https://github.com/0xsequence/czip/releases/download/v{{.Version}}/czip-compressor.linux-arm64)
Windows: [amd64](https://github.com/0xsequence/czip/releases/download/v{{.Version}}/czip-compressor.windows-amd64.exe), [arm64](https://github.com/0xsequence/czip/releases/download/v{{.Version}}/czip-compressor.windows-arm64.exe)
changelog:
use: github
sort: asc

brews:
- name: czip-compressor
ids:
- czip-compressor
tap:
owner: 0xsequence
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
commit_author:
name: goreleaserbot
email: [email protected]
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
homepage: "https://github.com/0xsequence/czip"
description: "czip: EVM Calldata Zip"
license: "MIT"
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release tag

on:
push:
tags:
- "v*"

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release -f .github/workflows/.goreleaser.yml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Log into Github registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Docker build
run: |
docker build --build-arg VERSION=${GITHUB_REF##*/} -t ghcr.io/0xsequence/czip-compressor:${GITHUB_REF##*/} -t ghcr.io/0xsequence/czip-compressor:latest .
docker push ghcr.io/0xsequence/czip-compressor:${GITHUB_REF##*/}
docker push ghcr.io/0xsequence/czip-compressor:latest
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
all:
@echo "Usage: make <target>"
@echo " where <target> is one of the following:"
@echo " foundryup"
@echo " foundrydown"
@echo " foundryclean"
@echo " foundryrestart"
@echo " foundrystatus"
@echo " bootstrap"
@echo " forge"
@echo " build"
@echo " test"

bootstrap: check-forge check-huffc forge

Expand Down
25 changes: 25 additions & 0 deletions compressor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -----------------------------------------------------------------
# Builder
# -----------------------------------------------------------------
FROM golang:1.22.0-alpine3.19 as builder
ARG VERSION

RUN apk add --update git

ADD ./ /src

WORKDIR /src
RUN go build -ldflags="-s -w -X github.com/0xsequence/czip/compressor.VERSION=${VERSION}" -o /usr/bin/czip-compressor ./cmd/czip-compressor

# -----------------------------------------------------------------
# Runner
# -----------------------------------------------------------------
FROM alpine:3.19

ENV TZ=UTC

RUN apk add --no-cache --update ca-certificates

COPY --from=builder /usr/bin/czip-compressor /usr/bin/

ENTRYPOINT ["/usr/bin/czip-compressor"]
3 changes: 3 additions & 0 deletions compressor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ build-cli:

install:
GOGC=off go install -v ./cmd/czip-compressor

docker-image:
@docker build -t 0xsequence/czip-compressor .
2 changes: 1 addition & 1 deletion compressor/cmd/czip-compressor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {
}

if len(args.Positional) < 1 {
fmt.Println("Usage: encode_sequence_tx / encode_call / encode_calls / encode_any / extras")
fmt.Printf("Usage (%s): encode_sequence_tx / encode_call / encode_calls / encode_any / extras\n", compressor.VERSION)
os.Exit(1)
}

Expand Down
3 changes: 3 additions & 0 deletions compressor/compressor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package compressor

var VERSION = "dev"

0 comments on commit f321b89

Please sign in to comment.