COMMIT
簡單指令CI_COMMIT_AUTHOR:
CI_COMMIT_BEFORE_SHA:
CI_COMMIT_BRANCH:
CI_COMMIT_DESCRIPTION:
CI_COMMIT_MESSAGE:
CI_COMMIT_REF_NAME:
stages:
- test
- deploy
run-tests:
stage: test
script:
- echo "Running tests for branch $CI_COMMIT_BRANCH by $CI_COMMIT_AUTHOR..."
- echo "Commit message: $CI_COMMIT_MESSAGE"
# 在這裡新增測試命令
deploy:
stage: deploy
only: #只能在maste分支做
- master
script:
- echo "Deploying to production environment for branch $CI_COMMIT_BRANCH by $CI_COMMIT_AUTHOR..."
- echo "Deployment description: $CI_COMMIT_DESCRIPTION"
# 在這裡新增生產環境的命令
這些環境變量由 GitLab CI/CD 自動提供,可在您的.gitlab-ci.yml配置中使用,以根據正在構建的提交或參考的具體詳細信息自定義管道階段和步驟。