Skip to content

Commit

Permalink
add --tags field
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter committed Oct 28, 2024
1 parent f5361e5 commit bc6547f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ inputs:
required: true
platform:
description: a string like 'linux/amd64'. run `viam module upload --help` for all options.
tags:
description: optional. comma-separated list of tags for precise platform targeting. run `viam module upload --help` for all options.
version:
description: version to set for the module. required if do-upload=true
do-update:
Expand All @@ -37,6 +39,7 @@ runs:
using: docker
image: Dockerfile
args:
# list of key, value for optional args
- ${{ inputs.meta-path && '--meta-path' || '' }}
- ${{ inputs.meta-path || '' }}
- ${{ inputs.module-path && '--module-path' || '' }}
Expand All @@ -51,6 +54,8 @@ runs:
- ${{ inputs.cli-config-secret || '' }}
- ${{ inputs.platform && '--platform' || '' }}
- ${{ inputs.platform || '' }}
- ${{ inputs.tags && '--tags' || '' }}
- ${{ inputs.tags || '' }}
- ${{ inputs.version && '--version' || '' }}
- ${{ inputs.version || '' }}
- ${{ fromJSON(inputs.do-update) && '--do-update' || '' }}
Expand Down
7 changes: 6 additions & 1 deletion upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def main():
p.add_argument('--key-id', required=True)
p.add_argument('--key-value', required=True)
p.add_argument('--platform')
p.add_argument('--tags')
p.add_argument('--version')
p.add_argument('--do-update', action='store_true')
p.add_argument('--do-upload', action='store_true')
Expand All @@ -43,6 +44,10 @@ def main():
elif args.namespace:
org_args = ('--public-namespace', args.namespace)

tags = ()
if args.tags:
tags = ('--tags', args.tags)

command = f"viam-{ARCH_LOOKUP[platform.uname().machine]}"
logging.info('selected command %s based on arch %s', command, platform.uname().machine)

Expand All @@ -52,7 +57,7 @@ def main():
subprocess.check_call([command, 'module', 'update', *meta_args])
logging.info('ran update')
if args.do_upload:
subprocess.check_call([command, 'module', 'upload', *meta_args, *org_args, '--platform', args.platform, '--version', args.version, args.module_path])
subprocess.check_call([command, 'module', 'upload', *meta_args, *org_args, '--platform', args.platform, *tags, '--version', args.version, args.module_path])
logging.info('ran upload')

if __name__ == '__main__':
Expand Down

0 comments on commit bc6547f

Please sign in to comment.