Skip to content

Commit

Permalink
chore(merging): 'ci-refactor-build-flow' into 'main'
Browse files Browse the repository at this point in the history
ci(gitlab-ci): 恢复手动触发打标签

See merge request sysu-gitlab/thesis-template/better-thesis!15
  • Loading branch information
huangjj27 committed May 19, 2024
2 parents 6ea2364 + 68fd2bf commit bc18e32
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions .gitlab/ci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo

default:
image: rust
cache:
paths:
- $CARGO_HOME
before_script:
- export PATH="$PATH:$CARGO_HOME/bin"
- cargo install typst-cli git-cliff sd

stages:
- check
- release

# each merge request are required to ensure compiling the `.typ`s file successfully.
check-typst-compile:
stage: check
image: rust
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo
cache:
paths:
- $CARGO_HOME
rules:
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
before_script:
- export PATH="$PATH:$CARGO_HOME/bin"
- cargo install typst-cli
- if: $CI_COMMIT_TAG
script:
- typst compile
--root=$CI_PROJECT_DIR
Expand All @@ -29,6 +32,26 @@ check-typst-compile:
# paths:
# - $CI_PROJECT_DIR/thesis_preview.pdf

release-commit:
stage: release
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
script:
- |
git config user.name $GITLAB_USER_NAME
git config user.email $GITLAB_USER_EMAIL
git remote set-url --push origin "https://sysu-bot:[email protected]/sysu-gitlab/thesis-template/better-thesis.git"
- |
VERSION=$(git cliff --bumped-version --unreleased)
git cliff --bump --unreleased > release-note.md
- |
sd 'version = ".*"' 'version = "$VERSION"' $CI_PROJECT_DIR/typst.toml
- |
git add $CI_PROJECT_DIR/typst.toml && git commit -m "ci(release):$VERSION"
git tag $VERSION -m --file=release-note.md
git push --tags
gitlab-release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
Expand Down

0 comments on commit bc18e32

Please sign in to comment.