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}`; }