Skip to content

Commit

Permalink
Upload rolling-shutter/v* tags as release on github
Browse files Browse the repository at this point in the history
  • Loading branch information
schmir committed Apr 5, 2022
1 parent 51fc0fc commit 1221ccd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
9 changes: 6 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ orbs:
executors:
cimg-base:
docker:
- image: cimg/base:2021.11
- image: cimg/base:2022.03

jobs:
gen:
Expand Down Expand Up @@ -46,6 +46,9 @@ jobs:
configuration_path: continue-generated.yml

workflows:
always:
gen:
jobs:
- gen
- gen:
filters:
tags:
only: /^.*$/
23 changes: 13 additions & 10 deletions .circleci/rolling-shutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
- attach_workspace:
at: ~/share
- run: ./build-release
- run: go install github.com/tcnksm/[email protected]
- 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
Expand Down Expand Up @@ -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
Expand All @@ -149,7 +152,7 @@ workflows:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
only: /^rolling-shutter\/v\d+\.\d+\.\d+$/
- rs-lint:
filters:
branches:
Expand Down
13 changes: 10 additions & 3 deletions rolling-shutter/build-release
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1221ccd

Please sign in to comment.