TeamCity Current Date variable in MMdd format

前端 未结 8 1400
谎友^
谎友^ 2021-01-31 04:16

In TeamCity is there an easy way to get a variable for the current date in the format MMdd (eg 0811 for 8-Aug)?

My google-fu did not turn up an existing plugins. I look

8条回答
  •  余生分开走
    2021-01-31 04:57

    To add a dated folder to my build in TeamCity I added the following to my custom script. What had me stuck was the double % sign in the date string. D'oh

    TARGET_DIR=/Users/admin/build/daily
    TARGET=$(date "+%%Y-%%m-%%d")
    
    if [ ! -d ${TARGET_DIR} ]; then
      mkdir -vp ${TARGET_DIR}/
    fi
    mv -v build.dmg ${TARGET_DIR}/build_${TARGET}.dmg
    

提交回复
热议问题