Put commit number into artifacts archive

mogikanin.tir's Avatar

mogikanin.tir

25 Aug, 2016 01:55 PM

Hi,
Is there a simple way to put commit number (git) into artifacts archive?
Let's say it might be simple text file version.txt with SHA inside it.

Thanks!

  1. 1 Posted by Ilya Finkelshte... on 25 Aug, 2016 10:27 PM

    Ilya Finkelshteyn's Avatar

    Hi,

    You can use APPVEYOR_REPO_COMMIT environment variable. Number of other useful variables can be found here https://www.appveyor.com/docs/environment-variables/

    Here is appveyor.yml section example you can use:

    install:
      - ps: '[System.IO.File]::WriteAllText("$env:APPVEYOR_BUILD_FOLDER\version.txt", $env:APPVEYOR_REPO_COMMIT)'
    artifacts:
    - path: version.txt
       name: version
    

    Hope this helps.

    --ilya.

  2. 2 Posted by mogikanin.tir on 26 Aug, 2016 06:11 AM

    mogikanin.tir's Avatar

    Thanks, it works :)
    Only I'm used after_build:

    after_build:
     - ps: '[System.IO.File]::WriteAllText("$env:APPVEYOR_BUILD_FOLDER\source\bin\$env:CONFIGURATION\version.txt", $env:APPVEYOR_REPO_COMMIT)'
    artifacts:
    - path: source\bin\Release
      name: Release
    
  3. 3 Posted by Ilya Finkelshte... on 26 Aug, 2016 05:38 PM

    Ilya Finkelshteyn's Avatar

    Yes, after_build is more logical place for this, I agree :)

  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:08 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? 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