Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to procedurally name artifacts?

- name: Archive Windows Build
  uses: actions/upload-artifact@v1
  with:
    name: "CISampleWin64Binary$(sh ./get-version.sh)" # How to insert var here?
    path: ./bin-win64

Trying to procedurally name my artifacts with the current version of the project. I'm don't know a whole lot about bash, sh, or unixy stuff. However, I'm guessing this name field just takes a string and does not parse like a bash string would. Is there anyway to achieve what I am looking to do?

like image 687
Matt Thompson Avatar asked Feb 01 '26 18:02

Matt Thompson


1 Answers

In order to use the the version within the with expression, it has to be a string as shown here.

Create an initial step that exports the variable to the environment:

- name: Export Archive Version
  run: echo "::set-env name=ARCHIVE_VERSION::$(./get-version.sh)"
  shell: sh

Now in your new step you use this variable from env:

- name: Archive Windows Build
  uses: actions/upload-artifact@v1
  with:
    name: "${{format('CISampleWin64Binary{0}', env.ARCHIVE_VERSION)}}"
    path: ./bin-win64
like image 57
smac89 Avatar answered Feb 03 '26 07:02

smac89



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!