-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github: make deployment more generic
Add a small tool to generate the matrix for building all versions of the app.
- Loading branch information
Showing
2 changed files
with
58 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import json | ||
import subprocess | ||
|
||
def git_tags(): | ||
cmd = ['git', 'tag', '--list', '--sort=version:refname'] | ||
|
||
return subprocess.run(cmd, text=True, stdout=subprocess.PIPE).stdout.strip().splitlines() | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--latest', action='store_true') | ||
args = parser.parse_args() | ||
|
||
tags = git_tags() | ||
|
||
if args.latest: | ||
print(tags[-1]) | ||
return | ||
|
||
tags = [ { 'ref': tag, 'name': tag } for tag in tags ] | ||
tags += [ { 'ref': 'main', 'name': 'testing' } ] | ||
|
||
matrix = { | ||
'include': tags, | ||
} | ||
|
||
print(json.dumps(matrix)) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters