question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can I use the templates in asset's path config?

See original GitHub issue

Hi there, thanks for the great project!

I have the following files:

dist/file1-v1.0.0.zip
dist/file1-v1.0.1.zip
dist/file1-v1.1.0.zip
...etc

I wanted to attach the last generated file on the release in question. For that, I had this configuration:

      [
        "@semantic-release/github",
        {
          "assets": "dist/*.zip"
        }
      ]

With the config above, all my files in dist/ folder were getting attached to each release in Github’s release page. So far so good, it was working as expected and it was a silly mistake of mine.

Then I tried to fix it by doing the following:

      [
        "@semantic-release/github",
        {
          "assets": "dist/*${nextRelease.version}.zip"
        }
      ]

But it didn’t work – no assets were attached to the next release. Am I missing something? Are templates even supported in path?

Thank you!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jedwards1211commented, Oct 28, 2020

@gr2m would you be opposed to a PR to also call template on the asset paths before actually globbing them?

1reaction
coderbyheartcommented, Jun 16, 2020

No, you can’t use the template strings when resolving files, because they are not replaced and passed verbatim: https://github.com/semantic-release/github/blob/32654fb26dbba597170408ab181255ae863ed748/lib/publish.js#L51-L60

I recommend to store assets with an unversioned name define individual asset entries, with a name property that contains the desired name.

Here is an example of how I use it in a project: https://github.com/bifravst/firmware/blob/8632a44c5201c24c554c06861cbb32db11682b26/package.json#L44-L90

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I properly set assets paths? - Craft CMS Stack Exchange
Uploading images through the CP works great, and images go to the correct folder, and are viewable in the CP. In the template...
Read more >
Accessing Files Inside Templates - Helm
In the previous section we looked at several ways to create and access named templates. This makes it easy to import one template...
Read more >
Assets - Maizzle
Any files that you add to your template sources will be copied over to the root of the build destination directory, so you...
Read more >
What is the proper way to link big template assets into rails erb ...
Rails.application.configure do config.assets.precompile += %w[common.js admin.js ... For them you can use a configuration .js.erb file.
Read more >
Using your own theme assets for help center - Zendesk help
You can reference an uploaded asset in the theme's style.css file or in its templates. In style.css, you use asset path variables provided ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found