stages: - prepare - test - build - release prepare-job: stage: prepare image: rust rules: - if: $CI_COMMIT_TAG when: never # Do not run this job when a tag is created manually - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch script: - echo "======== PREPARE JOB ========" - echo "PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml)" >> variables.env - echo "PKG_REGISTRY_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic" >> variables.env - echo $PKG_VERSION artifacts: reports: dotenv: variables.env test-job: stage: test image: rust:latest script: - echo "======== TESTS JOB ========" - apt update -m - apt install -y libfdisk-dev libclang-19-dev - cargo test --verbose build-job: stage: build image: rust:latest script: - echo "======== BUILD JOB ========" - apt update -m - apt install -y libfdisk-dev libclang-19-dev - cargo build --release - mkdir bin - mv /builds/ahoneybun/nyxi-installer/target/release/nyxi-installer bin/nyxi-installer-v${PKG_VERSION} artifacts: paths: - bin/ release-job: stage: release image: registry.gitlab.com/gitlab-org/release-cli:latest needs: - job: prepare-job artifacts: true - job: build-job script: - echo "======== RELEASE JOB ========" rules: - if: $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch release: tag_name: "v$PKG_VERSION" description: "NixOS installer in Rust : v$PKG_VERSION" ref: "$CI_COMMIT_SHA" # The tag is created from the pipeline SHA. assets: links: - name: "v$PKG_VERSION" url: "${PKG_REGISTRY_URL}/x86_64-unknown-linux-gnu/v${PKG_VERSION}/nyxi-installer" upload-job: stage: release image: curlimages/curl:latest needs: - job: prepare-job artifacts: true - job: build-job artifacts: true rules: - if: $CI_COMMIT_TAG when: never # Do not run this job when a tag is created manually - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch script: - echo "======== UPLOAD JOB ========" - ls -la bin/ - 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/nyxi-installer-v${PKG_VERSION} ${PKG_REGISTRY_URL}/x86_64-unknown-linux-gnu/v${PKG_VERSION}/nyxi-installer'