Fix built date on win, set revision to build number
{% set import_path = "gitlab.com/gitlab-org/gitlab-runner" %}
{% set version = "12.1.0" %}
{% set branch = '-'.join(version.split('.')[:2] +['stable']) %}
+{% set built = datetime.datetime.now().isoformat() %}
{% set name = import_path.split('/')[-1] %}
{% set pkg_src = ('src/'+import_path).replace("/", os.sep) %}
@@ -18,10 +19,7 @@ build:
number: 0
script:
- pushd {{ pkg_src }}
- #- for /F "delims=" %%i in ('date.exe /t +%Y-%m-%dT%H:%M:%S%z') DO set BUILT="%%i" # [win]
- - set BUILT="2019-08-14T00:00:00+0000" # [win]
- - export BUILT=$(date -u +%Y-%m-%dT%H:%M:%S%z) # [unix]
- {% set flags = dict(VERSION=version, REVISION="deadbeef", BRANCH=branch, BUILT="%BUILT%" if win else "$BUILT") %}
+ {% set flags = dict(VERSION=version, REVISION="%PKG_BUILDNUM%" if win else "$PKG_BUILDNUM", BRANCH=branch, BUILT=built) %}
- go install -v -ldflags "{% for key,value in flags.items() %}-X {{ import_path }}/common.{{ key }}='{{ value }}' {% endfor %}" .
requirements:
