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