Skip to content

Commit

Permalink
chore(merging): 'ci-adjust-ci-trigger' into 'main'
Browse files Browse the repository at this point in the history
ci(gitlab-ci): 优化流水线触发规则

Closes #4

See merge request sysu-gitlab/thesis-template/better-thesis!22
  • Loading branch information
huangjj27 committed May 21, 2024
2 parents b27479d + 580c9ae commit 25f8010
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions .gitlab/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,21 +34,18 @@ 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
- |
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
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
Expand All @@ -66,12 +62,14 @@ 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
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:
Expand All @@ -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
Expand Down

0 comments on commit 25f8010

Please sign in to comment.