diff --git a/.github/workflows/automated-release.yml b/.github/workflows/automated-release.yml index 966cef1d..00399eea 100644 --- a/.github/workflows/automated-release.yml +++ b/.github/workflows/automated-release.yml @@ -1,65 +1,35 @@ +--- +name: Release Binary + on: - push: - tags: - - "v*" - -name: Automated release build - + release: + types: [created] + +permissions: write-all + +# This workflow creates a release using goreleaser +# via the 'make release' command. + jobs: - build: - name: Build and upload release assets + release: runs-on: ubuntu-latest - + environment: release steps: - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.22 - id: go - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: true - allowUpdates: true - - # build & upload onomyd - - - name: Build onomyd - run: make build - - - name: Upload onomyd - id: upload-onomyd-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: onomyd - asset_name: onomyd - asset_content_type: application/bin - - # build & upload onomyd arm64 - - - name: Build onomyd arm64 - run: GOARCH=arm64 make build - - - name: Upload onomyd arm64 - id: upload-onomyd-release-asset-arm - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: onomyd - asset_name: onomyd-arm - asset_content_type: application/bin + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + check-latest: true + + - name: Setup release environment + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: |- + echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env + + - name: Release publish + run: make release \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..19e04f2f --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,104 @@ +before: + hooks: + - go mod download + +builds: + - id: "onomyd-darwin" + main: ./cmd/onomyd + binary: onomyd + env: + - CGO_ENABLED=1 + - CC=o64-clang + - CXX=o64-clang++ + goos: + - darwin + goarch: + - amd64 + flags: + - -tags=cgo + ldflags: + - -s -w -X github.com/cosmos/cosmos-sdk/version.Name=dymension -X github.com/cosmos/cosmos-sdk/version.AppName=onomyd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}} + - id: "onomyd-darwin-arm64" + main: ./cmd/onomyd + binary: onomyd + env: + - CGO_ENABLED=1 + - CC=oa64-clang + - CXX=oa64-clang++ + goos: + - darwin + goarch: + - arm64 + flags: + - -tags=cgo + ldflags: + - -s -w -X github.com/cosmos/cosmos-sdk/version.Name=dymension -X github.com/cosmos/cosmos-sdk/version.AppName=onomyd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}} + - id: "onomyd-linux" + main: ./cmd/onomyd + binary: onomyd + env: + - CGO_ENABLED=1 + - CC=gcc + - CXX=g++ + goos: + - linux + goarch: + - amd64 + flags: + - -tags=cgo + ldflags: + - -s -w -X github.com/cosmos/cosmos-sdk/version.Name=dymension -X github.com/cosmos/cosmos-sdk/version.AppName=onomyd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}} + - id: "onomyd-linux-arm64" + main: ./cmd/onomyd + binary: onomyd + env: + - CGO_ENABLED=1 + - CC=aarch64-linux-gnu-gcc + - CXX=aarch64-linux-gnu-g++ + goos: + - linux + goarch: + - arm64 + flags: + - -tags=cgo + ldflags: + - -s -w -X github.com/cosmos/cosmos-sdk/version.Name=dymension -X github.com/cosmos/cosmos-sdk/version.AppName=onomyd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}} + - id: "onomyd-windows" + main: ./cmd/onomyd + binary: onomyd + env: + - CGO_ENABLED=1 + - CC=x86_64-w64-mingw32-gcc + - CXX=x86_64-w64-mingw32-g++ + goos: + - windows + goarch: + - amd64 + flags: + - -tags=cgo + - -buildmode=exe + ldflags: + - -s -w -X github.com/cosmos/cosmos-sdk/version.Name=dymension -X github.com/cosmos/cosmos-sdk/version.AppName=onomyd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}} + +archives: + - name_template: '{{ .ProjectName }}_{{ .Version }}_{{- title .Os }}_{{ .Arch }}' + format_overrides: + - goos: windows + format: zip + builds: + - onomyd-darwin + - onomyd-darwin-arm64 + - onomyd-windows + - onomyd-linux + - onomyd-linux-arm64 + +checksum: + name_template: 'checksums.txt' +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +snapshot: + name_template: "{{ .Tag }}-next" \ No newline at end of file diff --git a/Makefile b/Makefile index 1500727e..dd4d66ad 100644 --- a/Makefile +++ b/Makefile @@ -87,6 +87,26 @@ format: gofumpt -lang=1.6 -extra -s -w $(SCAN_FILES) gogroup -order std,other,prefix=$(IMPORT_PREFIX) -rewrite $(SCAN_FILES) +PACKAGE_NAME:=github.com/onomyprotocol/onomy +GOLANG_CROSS_VERSION = v1.22 + +release: + @if [ ! -f ".release-env" ]; then \ + echo "\033[91m.release-env is required for release\033[0m";\ + exit 1;\ + fi + docker run \ + --rm \ + --privileged \ + -e CGO_ENABLED=1 \ + --env-file .release-env \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/go/src/$(PACKAGE_NAME) \ + -w /go/src/$(PACKAGE_NAME) \ + ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \ + release --clean --skip=validate + +.PHONY: release ############################################################################### ### Protobuf ### ############################################################################### diff --git a/cmd/onomyd/cmd/cmd.go b/cmd/onomyd/cmd/cmd.go index 49fa70a1..f1e3dea3 100644 --- a/cmd/onomyd/cmd/cmd.go +++ b/cmd/onomyd/cmd/cmd.go @@ -26,6 +26,10 @@ import ( // "github.com/cometbft/starport/starport/pkg/cosmoscmd". // "github.com/onomyprotocol/onomy/app" + + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + ibcprovidertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" ) // NewRootCmd initiates the cli for onomy chain. @@ -48,7 +52,8 @@ func NewRootCmd() *cobra.Command { } }() - // fmt.Println(tempApplication.GetTxConfig().NewTxBuilder() == nil). + // pull request #171 refactor: Remove ics. So we need re-register proto can read state + RegisterInterfacesICSProvider(encodingConfig.InterfaceRegistry) initClientCtx := client.Context{}. WithCodec(tempApplication.AppCodec()). @@ -160,5 +165,13 @@ var tempDir = func() string { } defer os.RemoveAll(dir) - return dir + return cmd +} + +// // pull request #171 refactor: Remove ics. So we need re-register proto can read state +func RegisterInterfacesICSProvider(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &ibcprovidertypes.ConsumerAdditionProposal{}, + ) }