File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747 && go get github.com/acroca/go-symbols@v0.1.1 && go get github.com/ramya-rao-a/go-outline@7182a932836a71948db4a81991a494751eccfe77 \
4848 # --> GolangCI-lint
4949 && curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sed 's/tar -/tar --no-same-owner -/g' | sh -s -- -b $(go env GOPATH)/bin \
50+ # --> Go releaser
51+ && curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh -s -- "v0.132.1" \
5052 # --> Install junit converter
5153 && go get github.com/jstemmer/go-junit-report@v0.9.1 \
5254 && rm -rf /go/src/ && rm -rf /go/pkg
Original file line number Diff line number Diff line change 1- name : build
1+ name : build-and-release
22
33on :
44 push :
1919 - name : Build devcontainer for tooling
2020 run : sudo -E make devcontainer
2121
22- - name : Run the build
23- run : sudo -E make devcontainer-build
22+ - name : Run the release
23+ run : sudo -E make devcontainer-release
24+ env :
25+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26+ BUILD_NUMBER : ${{ github.run_id }}
27+ IS_CI : 1
28+ IS_PR : ${{ github.head_ref }}
29+ BRANCH : ${{ github.ref }}
Original file line number Diff line number Diff line change 1- /devcontainer
1+ /devcontainer
2+ /dist
Original file line number Diff line number Diff line change 1+ builds :
2+ - env :
3+ - CGO_ENABLED=0
4+ goos :
5+ - linux
6+ - darwin
7+ - windows
8+ goarch :
9+ - 386
10+ - amd64
11+ main : ./cmd/devcontainer/
12+ ldflags :
13+ - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
14+ changelog :
15+ sort : asc
16+ filters :
17+ exclude :
18+ - ' ^docs:'
19+ - ' ^test:'
Original file line number Diff line number Diff line change 44devcontainer :
55 docker build -f ./.devcontainer/Dockerfile ./.devcontainer -t devcontainer-cli
66
7-
8- devcontainer-build :
7+ devcontainer-release :
98ifdef DEVCONTAINER
109 $(error This target can only be run outside of the devcontainer as it mounts files and this fails within a devcontainer. Don't worry all it needs is docker)
1110endif
1211 @docker run -v ${PWD}:${PWD} \
12+ -e BUILD_NUMBER="${BUILD_NUMBER}" \
13+ -e IS_CI="${IS_CI}" \
14+ -e IS_PR="${IS_PR}" \
15+ -e BRANCH="${BRANCH}" \
16+ -e GITHUB_TOKEN="${GITHUB_TOKEN}" \
1317 --entrypoint /bin/bash \
1418 --workdir "${PWD}" \
1519 devcontainer-cli \
16- -c "make build "
20+ -c "${PWD}/scripts/ci_release.sh "
Original file line number Diff line number Diff line change 1+ set -e
2+
3+ # Fail if build number not set
4+ if [ -z " $BUILD_NUMBER " ]; then
5+ echo " Env var 'BUILD_NUMBER' must be set for this script to work correctly"
6+ exit 1
7+ fi
8+
9+ # If running inside CI login to docker
10+ if [ -z ${IS_CI} ]; then
11+ echo " Not running in CI, skipping CI setup"
12+ else
13+ if [ -z $IS_PR ] && [[ $BRANCH == " refs/heads/master" ]]; then
14+ echo " On master setting PUBLISH=true"
15+ export PUBLISH=true
16+ else
17+ echo " Skipping publish as is from PR: $PR_NUMBER or not 'refs/heads/master' BRANCH: $BRANCH "
18+ fi
19+ fi
20+
21+ # Set version for release (picked up later by goreleaser)
22+ git tag -f v0.1.$BUILD_NUMBER
23+
24+ if [ -z ${PUBLISH} ]; then
25+ echo " Running with --skip-publish as PUBLISH not set"
26+ goreleaser --skip-publish --rm-dist
27+ else
28+ echo " Publishing release"
29+ goreleaser
30+ fi
You can’t perform that action at this time.
0 commit comments