feat(ghpublish): choose (pre)release depending on tag (#928)
While there, include integration testing to make sure the script is working as intended before using it. While there, edit maketarball.bash's comments.
This commit is contained in:
parent
7df25795c0
commit
ae0613fbb3
9 changed files with 72 additions and 6 deletions
32
script/ghpublish_test.bash
Executable file
32
script/ghpublish_test.bash
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
# Make sure we're not going to execute gh
|
||||
export gh="echo gh"
|
||||
|
||||
# Use a very old SHA as target
|
||||
export GITHUB_SHA="7327e1ff7f0cfdc5ff0335574b85dc8ceb9465b6"
|
||||
|
||||
# Test 1: make sure we're publishing to rolling as a
|
||||
# pre-release when the build targets a branch
|
||||
export GITHUB_REF="refs/heads/feature"
|
||||
./script/ghpublish.bash ABC > ghpublish.out.txt
|
||||
diff ./script/ghpublish-branch.out.txt ghpublish.out.txt
|
||||
|
||||
# Test 2: make sure we're publishing to rolling as a
|
||||
# pre-release when the build target is a PR
|
||||
export GITHUB_REF="refs/pull/123/merge"
|
||||
./script/ghpublish.bash ABC > ghpublish.out.txt
|
||||
diff ./script/ghpublish-pr.out.txt ghpublish.out.txt
|
||||
|
||||
# Test 3: make sure we're publishing to a pre-release when
|
||||
# we're building a tag that is not a stable release.
|
||||
export GITHUB_REF="refs/tags/v0.0.0-alpha"
|
||||
./script/ghpublish.bash ABC > ghpublish.out.txt
|
||||
diff ./script/ghpublish-prerelease.out.txt ghpublish.out.txt
|
||||
|
||||
# Test 3: make sure we're publishing to a release when
|
||||
# we're building a tag that is a stable release.
|
||||
export GITHUB_REF="refs/tags/v0.0.0"
|
||||
./script/ghpublish.bash ABC > ghpublish.out.txt
|
||||
diff ./script/ghpublish-release.out.txt ghpublish.out.txt
|
||||
Loading…
Reference in a new issue