0

We have a GitHub Actions workflow triggered by the creation of a release, i.e.,

on:
  release:
    types: [created]

How can we add the built files to the triggereing release as an asset from within the workflow?

I have seen this answer recommending softprops/action-gh-release, but that seems to apply to workflows triggered by pushes (with tags) and not "on release".

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Amos Egel
  • 937
  • 10
  • 24

1 Answers1

4

You can use the same action with the on: release trigger.

The GITHUB_REF environment variable or GitHub.ref context variable should contain the tag of the release.

See:

Another way to add files to the workflow is to use the GitHub CLI:

gh release upload $GITHUB_REF path/to/file path/to/file etc

That way you don't need to pull in actions from the marketplace.

${{ github.event.release.tag_name }}

Is another way to access the tag name.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341