The-Powder-Toy/.github/get-type.py

24 lines
913 B
Python
Raw Normal View History

2019-12-17 08:03:41 -06:00
import re
import sys
ref = sys.argv[1]
2021-06-30 15:13:24 -05:00
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)
2019-12-17 08:03:41 -06:00
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)))
2021-06-30 15:13:24 -05:00
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)))
2019-12-17 08:03:41 -06:00
elif match_snapshot:
print('::set-output name=TYPE::snapshot')
print('::set-output name=NAME::snapshot-%s' % match_snapshot.group(1))
else:
print('::set-output name=TYPE::dev')
print('::set-output name=NAME::dev')
with open('.github/mod_id.txt') as f:
print('::set-output name=MOD_ID::' + f.read())