From 1221ccd7b7ad8279776a60e1f5b7f0a34c31cf0f Mon Sep 17 00:00:00 2001 From: Ralf Schmitt Date: Tue, 5 Apr 2022 12:00:57 +0200 Subject: [PATCH] Upload rolling-shutter/v* tags as release on github --- .circleci/config.yml | 9 ++++++--- .circleci/rolling-shutter.yml | 23 +++++++++++++---------- rolling-shutter/build-release | 13 ++++++++++--- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0de8176d..3583ea52 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ orbs: executors: cimg-base: docker: - - image: cimg/base:2021.11 + - image: cimg/base:2022.03 jobs: gen: @@ -46,6 +46,9 @@ jobs: configuration_path: continue-generated.yml workflows: - always: + gen: jobs: - - gen + - gen: + filters: + tags: + only: /^.*$/ diff --git a/.circleci/rolling-shutter.yml b/.circleci/rolling-shutter.yml index 808ae3d5..aca3502c 100644 --- a/.circleci/rolling-shutter.yml +++ b/.circleci/rolling-shutter.yml @@ -87,18 +87,21 @@ jobs: steps: - checkout: path: ~/src + - run: + name: Configure environment + command: | + version=$(echo ${CIRCLE_TAG} | sed -e s#^rolling-shutter/##) + echo >>${BASH_ENV} export VERSION="${version}" + echo >>${BASH_ENV} export BIN=/tmp/release-bin - restore_cache: keys: - rs-build-go-integration-v3-{{ checksum "go.sum" }} - - run: env VERSION=${CIRCLE_TAG} ./build-release - - run: go install github.com/tcnksm/ghr@v0.13.0 - - attach_workspace: - at: ~/share + - run: ./build-release + - run: go install github.com/tcnksm/ghr@v0.14.0 - run: - name: Upload binaries and combined.json + name: Upload binaries command: | - cp ~/share/combined.json bin/ - ghr ${CIRCLE_TAG} bin/ + ghr ${CIRCLE_TAG} ${BIN} rs-lint: executor: go @@ -132,14 +135,14 @@ workflows: - rs-generate: filters: tags: - only: /^v\d+\.\d+\.\d+$/ + only: /.*/ - rs-build: matrix: parameters: go-version: [go-integration] filters: tags: - only: /^v\d+\.\d+\.\d+$/ + only: /.*/ - publish-release: requires: - rs-build @@ -149,7 +152,7 @@ workflows: branches: ignore: /.*/ tags: - only: /^v\d+\.\d+\.\d+$/ + only: /^rolling-shutter\/v\d+\.\d+\.\d+$/ - rs-lint: filters: branches: diff --git a/rolling-shutter/build-release b/rolling-shutter/build-release index f4fd376f..df8190fb 100755 --- a/rolling-shutter/build-release +++ b/rolling-shutter/build-release @@ -3,16 +3,23 @@ set -euo pipefail : "${GO:=go}" : "${VERSION:=}" -: "${TARGETS:=linux-amd64 linux-arm linux-arm64 freebsd-amd64 openbsd-amd64 darwin-amd64}" +: "${TARGETS:=linux-amd64 linux-arm64 freebsd-amd64 openbsd-amd64 darwin-amd64 darwin-arm64}" +: "${BIN:=bin}" + +function remove_version_prefix() { + echo "$1" | sed -e s#^rolling-shutter/## +} if [[ -z "${VERSION}" ]]; then - VERSION=$(git describe --tags --always --abbrev=4 --dirty --match 'rolling-shutter/v*' | sed -e s#^rolling-shutter/##) + VERSION=$(git describe --tags --always --abbrev=4 --dirty --match 'rolling-shutter/v*') fi +VERSION=$(remove_version_prefix "$VERSION") + git clean -xfd bin for osarch in ${TARGETS}; do IFS='-' read -r os arch <<< "${osarch}" - target=bin/rolling-shutter-${os}-${arch}-${VERSION} + target=${BIN}/rolling-shutter-${os}-${arch}-${VERSION} echo "Building ${target}" env GOARCH="${arch}" GOOS="${os}" ${GO} build -o "${target}" -ldflags "-X github.com/shutter-network/shutter/shuttermint/cmd/shversion.version=${VERSION}" . done