Skip to content

Commit

Permalink
pack.sh: versioning adjustments
Browse files Browse the repository at this point in the history
* When building on AppVeyor:

    Drop prerelease-suffix on tagged commits (official releases),
    or set canary-suffix when building the master-branch,
    or set rc-suffix when building a release-branch.

* When building from Git repo:

    Get commit SHA from local git-repo.
    Always set dev-suffix.

* Otherwise:

    Always set dev-suffix.

Following up a little bit on fuse-open#208, I think this new logic is less awkward.

I also added a canary-suffix on master-builds, and the idea is to set up a
canary-channel on NPM where we can easily publish the latest master-build.
  • Loading branch information
mortend committed Nov 11, 2019
1 parent 9f7eefe commit ba327bc
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions scripts/pack.sh
Expand Up @@ -10,32 +10,28 @@ rm -rf ${DST:?}/* 2> /dev/null || :
mkdir -p $DST

# Detect version info
COMMIT=`git rev-parse HEAD 2> /dev/null || :`
VERSION=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'`
BUILD_NUMBER="0"
SUFFIX="dev"
COMMIT="N/A"

if [ -n "$APPVEYOR_REPO_BRANCH" ]; then
BRANCH=$APPVEYOR_REPO_BRANCH
elif [ -n "$COMMIT" ]; then
BRANCH=`git rev-parse --abbrev-ref HEAD`
else
BRANCH="unknown"
COMMIT="unknown"
fi

if [ -n "$APPVEYOR_BUILD_NUMBER" ]; then
if [ -n "$APPVEYOR" ]; then
BUILD_NUMBER=$APPVEYOR_BUILD_NUMBER
else
BUILD_NUMBER=0
fi

# Use {dev, master}-COMMIT as prerelease suffix on non-release branches
if [ -n "$APPVEYOR_REPO_TAG_NAME" ]; then
# Don't set prerelease suffix on AppVeyor builds started by tag
SUFFIX=
elif [ "$BRANCH" = master ]; then
SUFFIX="master-${COMMIT:0:7}"
elif [[ "$BRANCH" != release-* ]]; then
SUFFIX="dev-${COMMIT:0:7}"
COMMIT=$APPVEYOR_REPO_COMMIT

# Drop prerelease-suffix on tagged commits (official releases),
# or set canary-suffix when building the master-branch,
# or set rc-suffix when building a release-branch.
if [ -n "$APPVEYOR_REPO_TAG_NAME" ]; then
SUFFIX=""
elif [ "$APPVEYOR_REPO_BRANCH" = master ]; then
SUFFIX="canary"
elif [ "$APPVEYOR_REPO_BRANCH" = release-* ]; then
SUFFIX="rc"
fi
elif [ -d .git ]; then
# Get commit SHA from local git-repo.
COMMIT=`git rev-parse HEAD 2> /dev/null || :`
fi

if [ -n "$SUFFIX" ]; then
Expand Down

0 comments on commit ba327bc

Please sign in to comment.