Add beta support to ghactions workflow

This commit is contained in:
Tamás Bálint Misius 2021-06-30 22:13:24 +02:00
parent dba0bcd535
commit a77bf9342b
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 16 additions and 3 deletions

11
.github/build.sh vendored
View File

@ -76,6 +76,14 @@ fi
if [ $PLATFORM_SHORT == "win" ]; then
bin_suffix=$bin_suffix.exe
fi
stable_or_beta="n"
if [ "$RELTYPE" == "beta" ]; then
other_flags+=$'\t-Dbeta=true'
stable_or_beta="y"
fi
if [ "$RELTYPE" == "stable" ]; then
stable_or_beta="y"
fi
if [ "$RELTYPE" == "snapshot" ]; then
other_flags+=$'\t-Dsnapshot=true\t-Dsnapshot_id='
other_flags+=`echo $RELNAME | cut -d '-' -f 2` # $RELNAME is snapshot-X
@ -84,7 +92,8 @@ if [ "$RELTYPE" == "snapshot" ] && [ "$MOD_ID" != "0" ]; then
>&2 echo "mods and snapshots do not mix"
exit 1
fi
if [ "$RELTYPE" == "stable" ] && [ "$MOD_ID" != "0" ]; then
if [ "$stable_or_beta" == "y" ] && [ "$MOD_ID" != "0" ]; then
# mods and snapshots both check their snapshot_id against whatever version starcatcher.us/TPT has
other_flags+=$'\t-Dsnapshot_id='
other_flags+=`echo $RELNAME | cut -d '.' -f 3` # $RELNAME is vX.Y.Z
fi

8
.github/get-type.py vendored
View File

@ -3,11 +3,15 @@ import sys
ref = sys.argv[1]
match_stable = re.match(r'refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)', ref)
match_snapshot = re.match(r'refs/tags/snapshot-([0-9]+)', ref)
match_stable = re.fullmatch(r'refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)', ref)
match_beta = re.fullmatch(r'refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)b', ref)
match_snapshot = re.fullmatch(r'refs/tags/snapshot-([0-9]+)', ref)
if match_stable:
print('::set-output name=TYPE::stable')
print('::set-output name=NAME::v%s.%s.%s' % (match_stable.group(1), match_stable.group(2), match_stable.group(3)))
elif match_beta:
print('::set-output name=TYPE::beta')
print('::set-output name=NAME::v%s.%s.%sb' % (match_beta.group(1), match_beta.group(2), match_beta.group(3)))
elif match_snapshot:
print('::set-output name=TYPE::snapshot')
print('::set-output name=NAME::snapshot-%s' % match_snapshot.group(1))