From 76f4982fd9e1a7db27680444738e26801778d92c Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 24 Jul 2016 21:39:45 +0100 Subject: [PATCH] Fix the root folder name inside CI-built archives They use HEAD as the branch name, because CI scripting was only fixing the names of the built archives. --- appveyor.yml | 3 --- scripts/archive.js | 12 +++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 07e8d850..75fa6841 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -37,9 +37,6 @@ after_test: # AppVeyor checks out a specific commit, but that means the archive script # can't tell which branch it's on, so rename the 7z archives. - ps: $env:GIT_DESCRIBE = ((git describe --tags --long) | Out-String) -replace "`n|`r", "" - - ps: mv "build\loot_$($env:GIT_DESCRIBE)_HEAD.7z" "build\loot_$($env:GIT_DESCRIBE)_$($env:APPVEYOR_REPO_BRANCH).7z" - - ps: mv "build\loot-api_$($env:GIT_DESCRIBE)_HEAD.7z" "build\loot-api_$($env:GIT_DESCRIBE)_$($env:APPVEYOR_REPO_BRANCH).7z" - - ps: mv "build\metadata-validator_$($env:GIT_DESCRIBE)_HEAD.7z" "build\metadata-validator_$($env:GIT_DESCRIBE)_$($env:APPVEYOR_REPO_BRANCH).7z" artifacts: - path: build\loot_$(GIT_DESCRIBE)_$(APPVEYOR_REPO_BRANCH).7z diff --git a/scripts/archive.js b/scripts/archive.js index 0f61a40a..73bd7221 100644 --- a/scripts/archive.js +++ b/scripts/archive.js @@ -22,12 +22,22 @@ function getGitDescription() { '--tags', '--long', ])).slice(0, -1); - const branch = String(childProcess.execFileSync('git', [ + let branch = String(childProcess.execFileSync('git', [ 'rev-parse', '--abbrev-ref', 'HEAD', ])).slice(0, -1); + /* On AppVeyor and Travis CI, a specific commit is checked out, so the branch + is HEAD. Use their stored branch value instead. */ + if (branch === 'HEAD') { + if (process.env.APPVEYOR_REPO_BRANCH) { + branch = process.env.APPVEYOR_REPO_BRANCH; + } else if (process.env.TRAVIS_BRANCH) { + branch = process.env.TRAVIS_BRANCH; + } + } + return `${describe}_${branch}`; }