TOOL/CI
[.gitlab-ci.yml] 매번 바뀌는 버전으로 지어진 파일명 잡기 (Windows10 Pro, Shell Executor)
forgiveall
2019. 12. 25. 18:15
GitLab-CI (깃랩씨아이)
꿀Tip - 매번 바뀌는 버전으로 지어진 파일명 잡기 (Windows10 Pro, Shell Executor)
버저닝해서 매번 이름이 다른 War파일을 선택하기 위해
환경: Windows10 Pro, Shell Executor
$ARTIFACT_WAR_NAME=(ls ./project/build/libs/myproject*.war | %{ $_.name }) -join ' ' | %{ $_.split(' ')}[0] echo $ARTIFACT_WAR_NAME
예시
deploy-app: stage: deploy tags: - your-shell-ci-tag only: - master - develop - /^.*ci-test.*$/ before_script: - $ARTIFACT_WAR_DIR="./installer_something_test/data/war" - echo "########## Check Before" - ls $ARTIFACT_WAR_DIR; echo $? - $ARTIFACT_WAR_NAME=(ls $ARTIFACT_WAR_DIR/jelly*.war | %{ $_.name }) -join ' ' | %{ $_.split(' ')}[0] - $ARTIFACT_WAR_PATH="${ARTIFACT_WAR_DIR}/${ARTIFACT_WAR_NAME}" - echo $ARTIFACT_WAR_PATH script: - echo "It works! Great!" - echo "Bye~"
Reference - 참고
- changing windows path to unix path [duplicate]: https://stackoverflow.com/questions/34286173/changing-windows-path-to-unix-path
- Passing directory contents as a single line to an executable in Powershell: https://stackoverflow.com/questions/1567927/passing-directory-contents-as-a-single-line-to-an-executable-in-powershell