From a2e11a302772a035f5fb0f1f5adb549b9c4df0ad Mon Sep 17 00:00:00 2001 From: Jeancarlo Date: Thu, 5 Oct 2023 19:25:50 -0400 Subject: [PATCH] chore: add release gh action --- .github/workflows/realease.yml | 46 +++++++++++++++++++++++++++++++ .github/workflows/test.yml | 5 +++- .gitignore | 4 +++ .goreleaser.yml | 50 ++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/realease.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/realease.yml b/.github/workflows/realease.yml new file mode 100644 index 00000000..38e7b1b7 --- /dev/null +++ b/.github/workflows/realease.yml @@ -0,0 +1,46 @@ +# triggered when a semantic version tag is pushed (vX.X.X) +name: Release +on: + push: + tags: + - "*" + - "v[0-9]+\\.[0-9]+\\.[0-9]+-alpha[0-9]+" # vX.X.X-alphaX + - "v[0-9]+\\.[0-9]+\\.[0-9]+-beta[0-9]+" # vX.X.X-betaX + - "v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+" # vX.X.X-rcX + - "v[0-9]+\\.[0-9]+\\.[0-9]+" # vX.X.X +concurrency: + group: ci-${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version: "1.21" + cache: true + + - name: Set ENV + run: echo "COMET_VERSION=$(go list -m github.com/cometbft/cometbft | sed 's:.* ::')" >> $GITHUB_ENV + + - name: goreleaser test-build + uses: goreleaser/goreleaser-action@v5 + if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Enable:ReleaseBuild') + with: + version: latest + args: build --clean --skip=validate + env: + COMET_VERSION: ${{ env.COMET_VERSION }} + - name: Release + uses: goreleaser/goreleaser-action@v5 + if: startsWith(github.ref, 'refs/tags/') + with: + version: latest + args: release --clean --release-notes ./RELEASE_NOTES.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMET_VERSION: ${{ env.COMET_VERSION }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0db76a85..cbc6a5b2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,8 @@ name: Tests / Code Coverage on: + push: + branches: + - main pull_request: types: [opened, synchronize, reopened, labeled] merge_group: @@ -55,7 +58,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version: "1.21" check-latest: true cache: true cache-dependency-path: go.sum diff --git a/.gitignore b/.gitignore index 6f5d7a04..b1a99b1d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ build/ .idea/ .vscode/ .DS_Store + +dist/ + +/.act-event-file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..212c25c8 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,50 @@ +project_name: seda + +env: + - CGO_ENABLED=1 +# - GOOS=linux # for local m1 mac run + +before: + hooks: + - go mod download + - go mod tidy + +builds: + - main: ./cmd/seda-chaind + id: "sedad" + binary: sedad + mod_timestamp: "{{ .CommitTimestamp }}" + flags: + - -tags=badgerdb ledger netgo + - -trimpath + ldflags: + - -s -w -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X github.com/cosmos/cosmos-sdk/version.Name=seda-chain -X github.com/cosmos/cosmos-sdk/version.AppName=sedad-chain -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Commit }} -X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger -X github.com/cometbft/cometbft/version.TMCoreSemVer={{ .Env.COMET_VERSION }} + goos: + - linux + goarch: + - amd64 +# - arm64 # github only supports linux @ amd64 :'( + +archives: + - id: tarball + format: tar.gz + wrap_in_directory: false # must not wrap into directory to support cosmwasm + name_template: "{{ .Binary }}-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + files: + - LICENSE + - README.md + +release: + github: + owner: sedaprotocol + name: seda + +snapshot: + name_template: SNAPSHOT-{{ .Commit }} + +checksum: + name_template: SHA256SUMS-v{{.Version}}.txt + algorithm: sha256 + +changelog: + skip: false \ No newline at end of file