poc_library 0.0.4

A POC library for the F5 CEDI Rust CICD template
Documentation
lint-job-lib:
  stage: lint
  script:
    - rustup component add clippy 
    - cd poc_library && cargo clippy

unit-test-job-lib:
  stage: test
  needs: ["lint-job-lib"]
  script:
    - cd poc_library
    - cargo test

build-job-lib:
  stage: build
  needs: ["unit-test-job-lib"]
  script:
    - cd poc_library
    - cargo build 
    
version-lib:
  stage: version
  needs: ["build-job-lib"]
  image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
  script:
    - release next-version --allow-current > .next-version
    - cp /usr/bin/release ./
    - cat .next-version
  artifacts:
    paths:
      - ./.next-version
      - ./release
  except:
    - tags

release-lib:
  stage: release
  needs: ["version-lib"]
  image: artifactory.f5net.com/dockerhub-remote/debian:buster-slim
  script:
    - set -euo pipefail
    - chmod +x release
    - ./release -v
    # the next line will fail if no feature or fix changes are found
    # in commits since last release tag
    - ./release changelog
    - ( apt-get -y update && apt-get -y install curl ) &> /tmp/apt.log || { cat /tmp/apt.log; false; }
    - version="$(cat .next-version)"
    - echo $version
    - sed -i "s/version =.*/version = \"$version\"/" poc_library/Cargo.toml
    - ./release commit-and-tag CHANGELOG.md poc_library/Cargo.toml
  when: manual
  allow_failure: false
  only:
    - main
  artifacts:
    paths:
      - ./poc_library/Cargo.toml

publish-to-crate-reg:
  stage: publish
  needs: ["release-lib"]
  script:
    - cargo login "${CRATES_API_TOKEN}"
    - cd poc_library && cargo publish --allow-dirty
  when: manual
  only:
    - main