tower / commit
Merge branch 'main' into forest
.gitlab-ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 011dab1..2bf7875 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,10 +30,16 @@ pages: # A push to any other branch rebuilds the site from the default branch, which is what # builds that branch's preview at /<branch>/. Parallel deployments would do this # natively, but they are Premium-only and this project is on the Free plan. +# +# Through the trigger API, with a pipeline trigger token in PAGES_TRIGGER_TOKEN (a masked +# CI/CD variable): a `trigger:` job cannot start a pipeline in its own project, and +# GitLab refuses it as invalid_bridge_trigger. preview: stage: deploy - trigger: - project: PavelSafronov/tower - branch: main + script: + - > + curl --fail --silent --show-error --output /dev/null + --form "token=$PAGES_TRIGGER_TOKEN" --form "ref=$CI_DEFAULT_BRANCH" + "$CI_API_V4_URL/projects/$CI_PROJECT_ID/trigger/pipeline" rules: - if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH