Skip to content

Commit

Permalink
ci(gitlab-ci): 修复CI脚本复用问题
Browse files Browse the repository at this point in the history
  • Loading branch information
huangjj27 committed May 17, 2024
1 parent 90a3430 commit 1e03e60
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .gitlab/ci.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
image: rust
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo

cache:
paths:
- $CARGO_HOME

stages:
- check
- release

before_script:
- export PATH="$PATH:$CARGO_HOME/bin"
- cargo install typst-cli git-cliff sd

# each merge request are required to ensure compiling the `.typ`s file successfully.
check-merge-request:
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
before_script:
- export PATH="$PATH:$CARGO_HOME/bin"
- cargo install typst-cli git-cliff sd
script:
- typst compile --root=$CI_PROJECT_DIR --font-path=$CI_PROJECT_DIR/fonts $CI_PROJECT_DIR/template/thesis.typ

check-default-branch:
stage: check
image: rust
variables:
CARGO_HOME: $CI_PROJECT_DIR/cargo
cache:
paths:
- $CARGO_HOME
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
before_script:
- export PATH="$PATH:$CARGO_HOME/bin"
- cargo install typst-cli git-cliff sd
script:
- typst compile --root=$CI_PROJECT_DIR --font-path=$CI_PROJECT_DIR/fonts $CI_PROJECT_DIR/template/thesis.typ $CI_PROJECT_DIR/thesis_preview.pdf
# TODO(#1): the preview pdf should be generated by template repo
Expand Down

0 comments on commit 1e03e60

Please sign in to comment.