Skip to content

Commit

Permalink
Merge pull request #2175 from Sifchain/feature/build-updates
Browse files Browse the repository at this point in the history
[ChainOps] Build updates
  • Loading branch information
intl-man authored Nov 15, 2021
2 parents 3790b5d + cd7582b commit d513d50
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 41 deletions.
41 changes: 16 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,41 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: Sifchain/sifchain-deploy
path: deploy
repository: Sifchain/sifchain-devops
path: sifchain-devops
token: "${{ secrets.GIT_PAT }}"

- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}

- name: Inject slug/short variables
uses: rlespinasse/[email protected]

- if: contains(github.ref, 'devnet')
run: |
echo "CHAINNET=testnet" >> "$GITHUB_ENV"
- if: contains(github.ref, 'testnet')
run: |
echo "CHAINNET=testnet" >> "$GITHUB_ENV"
- if: contains(github.ref, 'betanet')
- name: Get version
id: version
run: |
echo "CHAINNET=betanet" >> "$GITHUB_ENV"
- if: contains(github.ref, 'mainnet')
run: |
echo "CHAINNET=mainnet" >> "$GITHUB_ENV"
echo "::set-output name=version::$(cat version)"
- name: Build docker images
run: |
echo ${{ env.CHAINNET }}
make CHAINNET=${{ env.CHAINNET }} IMAGE_TAG=${{ env.GITHUB_REF_SLUG }} BINARY=sifnoded build-image
make CHAINNET=${{ env.CHAINNET }} IMAGE_TAG=${{ env.GITHUB_REF_SLUG }} BINARY=ebrelayer build-image
make IMAGE_TAG=${{ steps.version.outputs.version }} BINARY=sifnoded build-image
make IMAGE_TAG=${{ steps.version.outputs.version }} BINARY=ebrelayer build-image
- name: Push docker images
run: |
docker push sifchain/sifnoded:${{ env.GITHUB_REF_SLUG }}
docker push sifchain/ebrelayer:${{ env.GITHUB_REF_SLUG }}
docker push sifchain/sifnoded:${{ steps.version.outputs.version }}
docker push sifchain/ebrelayer:${{ steps.version.outputs.version }}
- name: Get commit hash
id: hash
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Release a new sifnoded binary
uses: ./deploy/release
uses: ./sifchain-devops/release
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
goarch: amd64
goversion: "1.16"
project_path: "./cmd/sifnoded"
binary_name: "sifnoded"
ldflags: "-X github.com/cosmos/cosmos-sdk/version.Name=sifchain -X github.com/cosmos/cosmos-sdk/version.ServerName=sifnoded -X github.com/cosmos/cosmos-sdk/version.ClientName=sifnoded -X github.com/cosmos/cosmos-sdk/version.Version=${{ steps.version.outputs.version }} -X github.com/cosmos/cosmos-sdk/version.Commit=${{ steps.hash.outputs.sha_short }}"
sha256sum: true
19 changes: 3 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CHAINNET?=testnet # Options; localnet, testnet, chaosnet ,mainnet
CHAINNET?=betanet
BINARY?=sifnoded
GOBIN?=${GOPATH}/bin
NOW=$(shell date +'%Y-%m-%d_%T')
Expand All @@ -9,33 +9,20 @@ HTTPS_GIT := https://github.com/sifchain/sifnode.git
DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf

ifeq (mainnet,${CHAINNET})
BUILD_TAGS=mainnet
else
BUILD_TAGS=testnet
endif

whitespace :=
whitespace += $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(BUILD_TAGS))

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=sifchain \
-X github.com/cosmos/cosmos-sdk/version.ServerName=sifnoded \
-X github.com/cosmos/cosmos-sdk/version.ClientName=sifnoded \
-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=$(build_tags_comma_sep)"
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)

BUILD_FLAGS := -ldflags '$(ldflags)' -tags ${BUILD_TAGS}
BUILD_FLAGS := -ldflags '$(ldflags)'

BINARIES=./cmd/sifnoded ./cmd/sifgen ./cmd/ebrelayer

all: lint install

build-config:
echo $(CHAINNET)
echo $(BUILD_TAGS)
echo $(BUILD_FLAGS)

init:
Expand Down

0 comments on commit d513d50

Please sign in to comment.