softprops / action-gh-release

📦 :octocat: GitHub Action for creating GitHub Releases
MIT License
3.91k stars 440 forks source link

[Feature request] Support asset properties `label`and `mime-type` #394

Open Guts opened 8 months ago

Guts commented 8 months ago

Firstly, thanks you for your action which is very useful 🙏.

Referring to the GitHub API documentation related to release publishing, it's possible to customize a label and mime-type (through content-type I guess) per asset: https://docs.github.com/fr/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset.

Content-type was supported by the unmaintained https://github.com/actions/upload-release-asset

On implementation's side, sadly I don't have any idea about how to achieve this. Some thoughts then.

Maybe using the files multilines input introducing a separator inline that allow the action split values like name|mime-type|label:

- name: Release
  uses: softprops/action-gh-release@v1
  if: startsWith(github.ref, 'refs/tags/')
  with:
    files: |
      Release.txt|text/plain|Changelog
      binary_win32.exe|application/vnd.microsoft.portable-executable|AwesomeTool for Windows
      binary_linux| application/zip|AwesomeTool for Linux
      binary_macos.zip|application/zip|AwesomeTool for MacOS

But it might be kinda delicate. So, maybe switching to an array of objects:

- name: Release
  uses: softprops/action-gh-release@v1
  if: startsWith(github.ref, 'refs/tags/')
  with:
    files:
      - name: Release.txt
        mimetype: text/plain
        label: Changelog
      - name: binary_win32.exe
        mimetype: application/vnd.microsoft.portable-executable
        label: AwesomeTool for Windows
      - name: binary_linux
        mimetype: application/zip
        label: AwesomeTool for Linux
      - name:  binary_macos.zip
        mimetype: application/zip
        label: AwesomeTool for MacOS