Setting output of a command as an environment variable

Suman Khanal's Avatar

Suman Khanal

23 Oct, 2021 10:54 AM

I want to clone a repo and build a binary from it. While building binary, I want to tag the binary with the 5 digits of a hash of the last commit.

I want to set tag as the output of a command git ls-remote git:// refs/heads/master | cut -f 1 | cut -c1-5.
Here is my yaml file:

# Manually build and don't use MSVC's build process so disable it
build: off

  - x64

    tag: TAG # TAG as the output of the command (git ls-remote git:// refs/heads/master | cut -f 1 | cut -c1-5)
  - brew install zstd
  - git clone -b master --single-branch
  - cd rakudo
  - perl --gen-moar --gen-nqp --backends=moar --relocatable --prefix=${APPVEYOR_BUILD_FOLDER}/rakudo-macos
  - make 
  - make install
  - export PATH=${APPVEYOR_BUILD_FOLDER}/rakudo-macos/bin:${APPVEYOR_BUILD_FOLDER}/rakudo-macos/share/perl6/site/bin:$PATH
  # note forward slash in the above line in macos
  - git clone -b master --single-branch
  - cd zef 
  - raku -I. bin/zef install . && cd .. && rm -rf zef
  - zef install App::Mi6 App::Prove6 Linenoise
  - 7z a ${APPVEYOR_BUILD_FOLDER}/rakudo-${tag}.zip ${APPVEYOR_BUILD_FOLDER}/rakudo-macos/*

    - master
  - path: rakudo-$(tag).zip
    name: rakudo-macos

Any tips how to achieve this? To tag with few digits a a hash of the last commit (of the repo being built)?

Thank you,

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

27 Jan, 2023 08:06 PM
27 Jan, 2023 08:05 PM
25 Jan, 2023 03:23 PM
25 Jan, 2023 03:22 PM
23 Jan, 2023 03:29 PM