Update .gitlab-ci.yml file
This commit is contained in:
parent
1a51313f21
commit
6a2bb64555
1 changed files with 29 additions and 0 deletions
29
.gitlab-ci.yml
Normal file
29
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- release
|
||||||
|
|
||||||
|
variables:
|
||||||
|
CRATE_NAME: "email2matrix-message-service"
|
||||||
|
TARGET_DIR: "target/release"
|
||||||
|
RELEASE_NAME: "v$(cat Cargo.toml | grep '^version' | cut -d '\"' -f 2)"
|
||||||
|
|
||||||
|
build:
|
||||||
|
stage: build
|
||||||
|
image: rust:latest
|
||||||
|
script:
|
||||||
|
- cargo build --release
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- $TARGET_DIR/
|
||||||
|
only:
|
||||||
|
- main # Build only on the master branch, adjust as needed
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
image: alpine:latest
|
||||||
|
script:
|
||||||
|
- apk add --no-cache curl
|
||||||
|
- 'curl -s --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" --upload-file $TARGET_DIR/$CRATE_NAME -o /dev/null "https://git.c4181.xyz/api/v4/projects/$CI_PROJECT_ID/uploads"'
|
||||||
|
- 'curl -s --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" -X POST -F "tag_name=$RELEASE_NAME" -F "ref=$CI_COMMIT_REF_NAME" -F "name=$RELEASE_NAME" -F "description=Release $RELEASE_NAME" "https://git.c4181.xyz/api/v4/projects/$CI_PROJECT_ID/releases"'
|
||||||
|
only:
|
||||||
|
- main # Deploy only on the master branch, adjust as needed
|
||||||
Loading…
Reference in a new issue