Skip to content

Commit

Permalink
Merge pull request #574 from buildpacks/feature/version-sevmer-gitsha…
Browse files Browse the repository at this point in the history
…1-update

Feature/version sevmer gitsha1 update
  • Loading branch information
jromero authored Apr 10, 2020
2 parents ba65dc8 + e66c5c6 commit 410225f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@ jobs:
run: make verify
- name: Test
run: make test
- name: Derive pack version from branch name
run: |
[[ $GITHUB_REF =~ ^refs\/heads\/release/(.*)$ ]] && version=${BASH_REMATCH[1]} || version=0.0.0
echo "::set-env name=PACK_VERSION::$version"
shell: bash
- name: Build
run: make build
env:
PACK_BUILD: ${{ github.run_number }}
- uses: actions/upload-artifact@v1
with:
name: pack-${{ matrix.os }}
Expand Down
31 changes: 23 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
ACCEPTANCE_TIMEOUT?=$(TEST_TIMEOUT)
ARCHIVE_NAME=pack-$(PACK_VERSION)
GOCMD?=go
GOFLAGS?=-mod=vendor
PACK_VERSION?=dev-$(shell date +%Y-%m-%d-%H:%M:%S)
PACK_BIN?=pack
PACKAGE_BASE=github.com/buildpacks/pack
SRC:=$(shell find . -type f -name '*.go' -not -path "*/vendor/*")
ARCHIVE_NAME=pack-$(PACK_VERSION)
PACK_BIN?=pack
PACK_GITSHA1=$(shell git rev-parse --short=7 HEAD)
PACK_VERSION?=0.0.0
SRC=$(shell find . -type f -name '*.go' -not -path "*/vendor/*")
TEST_TIMEOUT?=900s
UNIT_TIMEOUT?=$(TEST_TIMEOUT)
ACCEPTANCE_TIMEOUT?=$(TEST_TIMEOUT)

clean_build := $(strip ${PACK_BUILD})
clean_sha := $(strip ${PACK_GITSHA1})

# append build number and git sha to version, if not-empty
ifneq ($(and $(clean_build),$(clean_sha)),)
PACK_VERSION:=${PACK_VERSION}+git-${clean_sha}.build-${clean_build}
else ifneq ($(clean_build),)
PACK_VERSION:=${PACK_VERSION}+build-${clean_build}
else ifneq ($(clean_sha),)
PACK_VERSION:=${PACK_VERSION}+git-${clean_sha}
endif

export GOFLAGS:=$(GOFLAGS)
export CGO_ENABLED=0
Expand All @@ -24,12 +37,11 @@ mod-vendor:

tidy: mod-tidy mod-vendor format

build:
build: out
@echo "> Building..."
mkdir out
$(GOCMD) build -ldflags "-s -w -X 'github.com/buildpacks/pack/cmd.Version=${PACK_VERSION}'" -o ./out/$(PACK_BIN) -a ./cmd/pack

package:
package: out
tar czf ./out/$(ARCHIVE_NAME).tgz -C out/ pack

install-mockgen:
Expand Down Expand Up @@ -97,4 +109,7 @@ prepare-for-pr: tidy verify test
echo "-----------------\n" &&\
exit 0;

out:
mkdir out

.PHONY: clean build format imports lint test unit acceptance verify verify-format

0 comments on commit 410225f

Please sign in to comment.