Skip to content

feat(release): support `direct_asset_path` and alias `filepath`

Timo Furrer requested to merge release-assets-links-direct-asset-path into main

Description

This change set introduces support for the direct_asset_path field for Release Assets Links. The direct_asset_path is the successor of the deprecated filepath (AFAIK, it's basically a rename). The filepath is also deprecated and aliased to the direct_asset_path on API level. If both, the direct_asset_path and filepath are specified an error is raised to the user.

Related Issues

Resolves #1195 (closed)

How has this been tested?

  • unit tests
  • manual tests:

Specifying direct_asset_path only:

./bin/glab release -R timofurrer/playground create v1.0.2 --assets-links='[{"name": "test-name", "url":"https://tuxtimo.me/assets", "direct_asset_path": "/my-path"}]'
• Validating tag v1.0.2
• Tag does not exist.
• No ref was provided. Tag will be created from the latest state of the default branch
• using default branch "main" as ref

? Release Title (optional) test
? Release notes Leave blank
• Creating or updating release repo=timofurrer/playground tag=v1.0.2
✓ Release created       url=https://gitlab.com/timofurrer/playground/-/releases/v1.0.2
• Uploading release assets repo=timofurrer/playground tag=v1.0.2
✓ Added release asset   name=test-name url=https://gitlab.com/timofurrer/playground/-/releases/v1.0.2/downloads/my-path
✓ Release succeeded after 1.41s

Specifying filepath only:

./bin/glab release -R timofurrer/playground create v1.0.3 --assets-links='[{"name": "test-name", "url":"https://tuxtimo.me/assets", "filepath": "/my-path"}]'
• Validating tag v1.0.3

? Release Title (optional) test2
? Release notes Leave blank
• Creating or updating release repo=timofurrer/playground tag=v1.0.3
✓ Release created       url=https://gitlab.com/timofurrer/playground/-/releases/v1.0.3
• Uploading release assets repo=timofurrer/playground tag=v1.0.3
✓ Added release asset   name=test-name url=https://gitlab.com/timofurrer/playground/-/releases/v1.0.3/downloads/my-path
✓ Release succeeded after 1.04s

Specifying direct_asset_path and filepath:

./bin/glab release -R timofurrer/playground create v1.0.4 --assets-links='[{"name": "test-name", "url":"https://tuxtimo.me/assets", "filepath": "/my-path", "direct_asset_path": "/another-path"}]'
• Validating tag v1.0.4
• Tag does not exist.
• No ref was provided. Tag will be created from the latest state of the default branch
• using default branch "main" as ref

? Release Title (optional) test3
? Release notes Leave blank
• Creating or updating release repo=timofurrer/playground tag=v1.0.4
✓ Release created       url=https://gitlab.com/timofurrer/playground/-/releases/v1.0.4
• Uploading release assets repo=timofurrer/playground tag=v1.0.4
x release failed after 0.97s error=asset link can either specify `direct_asset_path` or `filepath` (`filepath` is deprecated).

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by Timo Furrer

Merge request reports

Loading