diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6bc60149ffd5d2bddaa4065a8635315c6476e98f..f3d33e668933d820a6e1ae11cacb946655fa2435 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,28 +4,32 @@ image: "rust:latest" stages: - - build + - build_and_package - release -build: - stage: build - # image used for this build - image: rust - # build script +build_and_package: + stage: build_and_package + image: rust:slim-buster script: + # Build the project - cargo build --release - # output file + # Install cargo-deb + - cargo install cargo-deb + # Create Debian package + - cargo deb --no-build + - ls target/debian/*.deb | head -n 1 > debian_package.txt artifacts: paths: - target/release/gcli - # use cache to avoid re-downloading and re-building all dependencies + - target/debian/*.deb + - debian_package.txt cache: key: files: - Cargo.lock paths: - target/release - # only build gcli when adding a tag + - target/debian only: - tags @@ -48,11 +52,16 @@ release: # Attach the artifact to the release assets: links: - - name: "gcli v$CI_COMMIT_TAG for Linux" - url: "$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/target/release/gcli?job=build" + - name: "gcli v$CI_COMMIT_TAG for Linux (binary)" + url: "$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/target/release/gcli?job=build_and_package" + - name: "gcli v$CI_COMMIT_TAG Debian Package" + url: "$CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_TAG/raw/$(cat debian_package.txt)?job=build_and_package" # Trigger release creation only for tagged commits only: - tags # Not necessary but clearly shows the dependency dependencies: - - build + - build_and_package + artifacts: + paths: + - debian_package.txt diff --git a/Cargo.lock b/Cargo.lock index 662b0019d632beb42fa8b795ff5248763ac1a3a4..444763b3e939217442dbc922cc3d7e0fabf91c2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2092,7 +2092,7 @@ dependencies = [ [[package]] name = "gcli" -version = "0.2.10" +version = "0.2.11" dependencies = [ "age", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 980fbbfa1dbde8e5bfde75f1816acf3f0e764958..af0852cfe15638914bebccee05ef3dfd230edac6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ rust-version = "1.75.0" license = "AGPL-3.0-only" name = "gcli" repository = "https://git.duniter.org/clients/rust/gcli-v2s" -version = "0.2.10" +version = "0.2.11" [dependencies] # subxt is main dependency