# Define the stages of the pipeline
stages:
- check-lint
- publish
rustfmt-check:
stage: check-lint
image: rust:latest
before_script:
- rustup component add rustfmt
- rustup --version
script:
- cargo fmt -- --check
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_DRAFT != "true"'
publish:
stage: publish
image: rust:latest
before_script:
- rustup component add cargo
- rustup --version
script:
- cargo publish --token $CRATES_IO_TOKEN
rules:
- if: '$CI_COMMIT_BRANCH == "main"'