Closed cdce8p closed 2 years ago
Thanks! Another note about this action (not related to this PR, but something we should consider), this is not that reusable, as this will handle wheels and sdist for python packages only.
I think it's better to refactor this action to take a single file (or all files in the folder passed), so it can be used in other types of repos like https://github.com/home-assistant/operating-system/releases/tag/7.5
And potentially split it up into 2 actions:
- Get current assets (
helpers/release-assets/list
)- Upload asset(s) (
helpers/release-assets/upload
)That way the workflow that calls the action can skip build steps if the asset already exists.
I've started workin on that. Won't finish it until later today though.
Atm I've created two sub-actions: list
and upload-file
. I'm a bit skeptical about uploading a whole folder. At least here it wouldn't quite work as both files have different content-types application/zip
vs application/gzip
.
Does the upload action require to set the right content type?
Does the upload action require to set the right content type?
I think so. https://docs.github.com/en/rest/reference/releases#upload-a-release-asset
[...]
Use the required Content-Type header to provide the media type of the asset.
For a list of media types, see [Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml).
For example: application/zip
-- Just doing some final testing, but the next version will be much more versatile. It can can handle uploading an entire folder or individual files and includes a configurable mapping between file names and content types. https://github.com/home-assistant/actions/compare/master...cdce8p:rewrite-release-assets
Example job step for the frontend action
- name: Upload release assets
uses: home-assistant/actions/helpers/release-assets@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
path: dist/
file_filter: "*.whl, *.tar.gz"
content_type_map: "*.whl=application/zip, *.tar.gz=application/gzip"
delete_existing_assets: true
I'll open a new actions PR for it later.
Nice!
Could you derive the file filter from the content map?
Could you derive the file filter from the content map?
Great idea! I've also change path
to paths
which now allows passing multiple comma-separated values.
Opened #68 with the rewrite PR.
No longer needed. See #69
Based on feedback in #61
Replaced archived action with direct API calls. https://docs.github.com/en/rest/reference/releases#upload-a-release-asset
Example run in my fork: https://github.com/cdce8p/ha-frontend/runs/5559907160?check_suite_focus=true#step:3:62