CICD: Build: Use Cargo.toml version instead of tag

This enables us to later always build Debian packages. If you try to use
a git sha as Debian package version you will get an error:

    dpkg-deb: error: parsing file '_staging/dpkg/DEBIAN/control' near line 2 package 'bat':
     error in 'Version' field string 'd2963ce4': version number does not start with digit

so we need to use a version that is always available.

We duplicate the bat version in another place here which is a bit bad,
but it is already duplicated a lot, so we don't make things
significantly worse. It is still kind of nice to not have to figure out
a good and robust way to parse out the version from Cargo.toml in the CI
script.

For #1474
This commit is contained in:
Martin Nordholts 2021-01-09 20:53:54 +01:00 committed by David Peter
parent 43919066ad
commit 9a3a5545e7
1 changed files with 2 additions and 2 deletions

View File

@ -2,6 +2,7 @@ name: CICD
env:
PROJECT_NAME: bat
PROJECT_VERSION: "0.17.1"
PROJECT_DESC: "A `cat` clone with wings"
PROJECT_MAINTAINER: "David Peter <mail@david-peter.de>"
PROJECT_HOMEPAGE: "https://github.com/sharkdp/bat"
@ -116,10 +117,9 @@ jobs:
echo ::set-output name=EXE_suffix::${EXE_suffix}
# parse commit reference info
unset REF_TAG ; case ${GITHUB_REF} in refs/tags/*) REF_TAG=${GITHUB_REF#refs/tags/} ;; esac;
REF_SHAS=${GITHUB_SHA:0:8}
# package name
PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac;
PKG_BASENAME=${PROJECT_NAME}-${REF_TAG:-$REF_SHAS}-${{ matrix.job.target }}
PKG_BASENAME=${PROJECT_NAME}-v${PROJECT_VERSION}-${{ matrix.job.target }}
PKG_NAME=${PKG_BASENAME}${PKG_suffix}
echo ::set-output name=PKG_BASENAME::${PKG_BASENAME}
echo ::set-output name=PKG_NAME::${PKG_NAME}