From 5377605a3106e4f3dc811f5a6772f1dd8104d857 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 21 May 2024 09:52:28 +0800 Subject: [PATCH 1/5] =?UTF-8?q?ci(gitlab-ci):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=E4=BD=9C=E4=B8=9A=E8=A7=A6=E5=8F=91?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仅当在 web 页面上触发 main 分支流水线时才执行 release-commit,并且限制语义化版本的正式版本标签才会触发发布操作 --- .gitlab/ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.gitlab/ci.yml b/.gitlab/ci.yml index 6790286..aa5c14c 100644 --- a/.gitlab/ci.yml +++ b/.gitlab/ci.yml @@ -16,8 +16,7 @@ check-typst-compile: stage: check rules: - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - if: $CI_COMMIT_TAG + - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install typst-cli @@ -35,8 +34,7 @@ check-typst-compile: release-commit: stage: release rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - when: manual + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE = "web" before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install git-cliff sd @@ -71,7 +69,7 @@ gitlab-release: stage: release image: registry.gitlab.com/gitlab-org/release-cli:latest rules: - - if: $CI_COMMIT_TAG + - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ script: - echo "releasing $CI_COMMIT_TAG on GitLab!" release: @@ -81,8 +79,7 @@ gitlab-release: typst.universe-release: stage: release rules: - - if: $CI_COMMIT_TAG - # - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH + - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install sd From 5c1de83c50072f67505e8521a82deb4507d1e20e Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 21 May 2024 09:58:53 +0800 Subject: [PATCH 2/5] =?UTF-8?q?ci(gitlab-ci):=20=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=8F=90=E4=BA=A4=E4=BB=BB=E5=8A=A1=E4=B8=AD?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=9A=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab/ci.yml b/.gitlab/ci.yml index aa5c14c..78faf2c 100644 --- a/.gitlab/ci.yml +++ b/.gitlab/ci.yml @@ -41,6 +41,7 @@ release-commit: - | curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash apt-get install git-lfs + - git remote add ci "https://sysu-bot:$SYSU_BOT_TOKEN@gitlab.com/sysu-gitlab/thesis-template/better-thesis.git" script: - | git config user.name $GITLAB_USER_NAME @@ -64,6 +65,8 @@ release-commit: git tag $BUMPED_VERSION --file=release-note.md - git push ci HEAD:$CI_COMMIT_BRANCH - git push ci HEAD:$CI_COMMIT_BRANCH --tags + after_script: + - git remote rm ci gitlab-release: stage: release From c235feacc172ce7a4db9dec0023341cf597e235f Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 21 May 2024 09:59:44 +0800 Subject: [PATCH 3/5] =?UTF-8?q?ci(gitlab-ci):=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E6=A3=80=E6=B5=8B=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=E7=9A=84=E8=A7=A6=E5=8F=91=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab/ci.yml b/.gitlab/ci.yml index 78faf2c..f680abd 100644 --- a/.gitlab/ci.yml +++ b/.gitlab/ci.yml @@ -17,6 +17,7 @@ check-typst-compile: rules: - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ + # - if: $CI_COMMIT_TAG # trigger rule for debugging before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install typst-cli @@ -35,6 +36,7 @@ release-commit: stage: release rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE = "web" + # - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH # trigger rules for debugging before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install git-cliff sd @@ -46,9 +48,6 @@ release-commit: - | git config user.name $GITLAB_USER_NAME git config user.email $GITLAB_USER_EMAIL - - | - git remote rm ci || true - git remote add ci "https://sysu-bot:$SYSU_BOT_TOKEN@gitlab.com/sysu-gitlab/thesis-template/better-thesis.git" - | BUMPED_VERSION=$(git cliff --bumped-version --unreleased) git cliff --bump --unreleased -- --newest > release-note.md @@ -83,6 +82,7 @@ typst.universe-release: stage: release rules: - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ + # - if: $CI_COMMIT_TAG # trigger rule for debugging before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install sd From a1e69aadd68083f7f224d984c4654aa0d52bd2df Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 21 May 2024 10:11:01 +0800 Subject: [PATCH 4/5] =?UTF-8?q?ci(gitlab-ci):=20=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab/ci.yml b/.gitlab/ci.yml index f680abd..ccfdc9d 100644 --- a/.gitlab/ci.yml +++ b/.gitlab/ci.yml @@ -15,9 +15,9 @@ stages: check-typst-compile: stage: check rules: - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH - - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ - # - if: $CI_COMMIT_TAG # trigger rule for debugging + # - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH + # - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ + - if: $CI_COMMIT_TAG # trigger rule for debugging before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install typst-cli @@ -35,8 +35,8 @@ check-typst-compile: release-commit: stage: release rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE = "web" - # - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH # trigger rules for debugging + # - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "web" + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH # trigger rules for debugging before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install git-cliff sd @@ -81,8 +81,8 @@ gitlab-release: typst.universe-release: stage: release rules: - - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ - # - if: $CI_COMMIT_TAG # trigger rule for debugging + # - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ + - if: $CI_COMMIT_TAG # trigger rule for debugging before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install sd From 580c9ae95ad8927978536043602e0cf68040e259 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 21 May 2024 10:15:35 +0800 Subject: [PATCH 5/5] =?UTF-8?q?ci(gitlab-ci):=20=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8=E7=9A=84=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=E8=A7=A6=E5=8F=91=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab/ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.gitlab/ci.yml b/.gitlab/ci.yml index ccfdc9d..9cd5be6 100644 --- a/.gitlab/ci.yml +++ b/.gitlab/ci.yml @@ -15,9 +15,8 @@ stages: check-typst-compile: stage: check rules: - # - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH - # - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ - - if: $CI_COMMIT_TAG # trigger rule for debugging + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH + - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install typst-cli @@ -35,8 +34,7 @@ check-typst-compile: release-commit: stage: release rules: - # - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "web" - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH # trigger rules for debugging + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "web" before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install git-cliff sd @@ -81,8 +79,7 @@ gitlab-release: typst.universe-release: stage: release rules: - # - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ - - if: $CI_COMMIT_TAG # trigger rule for debugging + - if: $CI_COMMIT_TAG =~ /v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*/ before_script: - export PATH="$PATH:$CARGO_HOME/bin" - cargo install sd