Dynamic naming of build artifacts based on commit reference #25463
-
I’ve been staring at the docs for about half an hour, but honestly I’ve got no idea what I’m doing so I figure it’s worth asking for some more direct help. github.comJademalo/SurroundFix/blob/73be46e74fd1748e5a02ba3ea6f5c9f9f884164e/.github/workflows/package.yml
This file has been truncated. show original My repo has a fairly simple action - When a commit is made to a branch that isn’t master, run the BigWigs packager and upload the artifacts. The packager creates two zip files, The packager runs twice to create each zip, and it also creates a folder, simply called That would leave me with two zip artifacts named as above, each containing a folder called How exactly would I go about doing that?
I know that’s basically what I want to do, but I have absolutely no idea how to do that. docs.github.comContext and expression syntax for GitHub Actions - GitHub DocsBased on this page, I assume it’s something to do with ${{ github.head_ref }} or something similar, but I’ve got absolutely no idea how to find the name of the folder to append to the start, no idea how to get the git reference, and no idea how to combine the values into a complete name.
If anyone can give me any help with this, I’d hugely appreciate it. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Jademalo:
I’d use the
I’m not sure what you mean by finding the folder name, I thought that’s fixed? If you’re talking about the version number you can just store it in an environment variable and use the |
Beta Was this translation helpful? Give feedback.
-
Oh, that’s fairly simple, I thought there would have to be something fancy to combine the string. The folder name should always be the same, but I’d ideally like to try and make it dynamic as there are a couple of potential future sitautions where it might change.
Do I need to be doing something like this to get a variable with the name of the folder? |
Beta Was this translation helpful? Give feedback.
-
Basically yes! Though I assume that the folder name is going to be a bit too dynamic to set it in the workflow or job, so it’s probably best to create it in a step and write it to the environment file so it’s available to the following steps:
The code in the |
Beta Was this translation helpful? Give feedback.
-
Awesome, I think I should be able to get it to work with this. I know for certain that there’s a way to get a folder name from bash. Thanks! EDIT: Jademalo/SurroundFixA World of Warcraft UI AddOn to fix various UI issues with multiple monitor setups - Jademalo/SurroundFix
I found a bit of bash that output the directory name and removed the trailing slash, then realised I could do the same thing to just put git describe into a variable too. Thanks again for the help! |
Beta Was this translation helpful? Give feedback.
Basically yes! Though I assume that the folder name is going to be a bit too dynamic to set it in the workflow or job, so it’s probably best to create it in a step and write it to the environment file so it’s available to the following steps:
The code in the
run
step is regular Bash. You can use other interpreters or call scripts, the important thing is that thefolder_name=...
assignment end…