Skip to content

Commit bc18e32

Browse files
committed
chore(merging): 'ci-refactor-build-flow' into 'main'
ci(gitlab-ci): 恢复手动触发打标签 See merge request sysu-gitlab/thesis-template/better-thesis!15
2 parents 6ea2364 + 68fd2bf commit bc18e32

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

.gitlab/ci.yml

+33-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1+
variables:
2+
CARGO_HOME: $CI_PROJECT_DIR/cargo
3+
4+
default:
5+
image: rust
6+
cache:
7+
paths:
8+
- $CARGO_HOME
9+
before_script:
10+
- export PATH="$PATH:$CARGO_HOME/bin"
11+
- cargo install typst-cli git-cliff sd
12+
113
stages:
214
- check
315
- release
416

517
# each merge request are required to ensure compiling the `.typ`s file successfully.
618
check-typst-compile:
719
stage: check
8-
image: rust
9-
variables:
10-
CARGO_HOME: $CI_PROJECT_DIR/cargo
11-
cache:
12-
paths:
13-
- $CARGO_HOME
1420
rules:
1521
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
16-
- if: $CI_COMMIT_TAG
1722
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
18-
before_script:
19-
- export PATH="$PATH:$CARGO_HOME/bin"
20-
- cargo install typst-cli
23+
- if: $CI_COMMIT_TAG
2124
script:
2225
- typst compile
2326
--root=$CI_PROJECT_DIR
@@ -29,6 +32,26 @@ check-typst-compile:
2932
# paths:
3033
# - $CI_PROJECT_DIR/thesis_preview.pdf
3134

35+
release-commit:
36+
stage: release
37+
rules:
38+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
39+
when: manual
40+
script:
41+
- |
42+
git config user.name $GITLAB_USER_NAME
43+
git config user.email $GITLAB_USER_EMAIL
44+
git remote set-url --push origin "https://sysu-bot:[email protected]/sysu-gitlab/thesis-template/better-thesis.git"
45+
- |
46+
VERSION=$(git cliff --bumped-version --unreleased)
47+
git cliff --bump --unreleased > release-note.md
48+
- |
49+
sd 'version = ".*"' 'version = "$VERSION"' $CI_PROJECT_DIR/typst.toml
50+
- |
51+
git add $CI_PROJECT_DIR/typst.toml && git commit -m "ci(release):$VERSION"
52+
git tag $VERSION -m --file=release-note.md
53+
git push --tags
54+
3255
gitlab-release:
3356
stage: release
3457
image: registry.gitlab.com/gitlab-org/release-cli:latest

0 commit comments

Comments
 (0)