Commit 82a559a3 authored by Michael Tesch's avatar Michael Tesch
Browse files

Merge branch 'master' of gitlab.com:tesch1/cppduals

parents 7bbe6ba6 2e3c4e10
Loading
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@ stages:
- test
- cover
- pages
- tag
- upload
- release

@@ -97,25 +96,6 @@ pages:
    when: manual
    allow_failure: true

# Auto-tag when version in CMakeLists.txt is newer than latest git tag
auto-tag:
  stage: tag
  script:
  - dnf install -y git
  - VERSION=$(sed -n 's/.*VERSION \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' CMakeLists.txt)
  - |
    if git ls-remote --tags origin "refs/tags/v${VERSION}" | grep -q .; then
      echo "Tag v${VERSION} already exists, skipping"
    else
      echo "Creating tag v${VERSION}"
      git tag "v${VERSION}"
      git push "https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" "v${VERSION}"
    fi
  rules:
  - if: $CI_COMMIT_TAG
    when: never
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

variables:
  # Package version can only contain numbers (0-9), and dots (.).
  # Must be in the format of X.Y.Z, i.e. should match /\A\d+\.\d+\.\d+\z/ regular expresion.
+11 −8
Original line number Diff line number Diff line
@@ -54,23 +54,26 @@ Build output goes to `Build-clang/`, `Build-clangr/`, `Build-cc/`, `Build-ccr/`,

## Versioning and Releases

The version is defined in the top-level `CMakeLists.txt` (`project(cppduals VERSION X.Y.Z ...)`). GitLab CI (`.gitlab-ci.yml`) handles tagging, packaging, and release creation automatically:
The version is defined in the top-level `CMakeLists.txt` (`project(cppduals VERSION X.Y.Z ...)`). GitLab CI (`.gitlab-ci.yml`) handles packaging and release creation automatically when a tag is pushed:

- **auto-tag** stage: when a commit lands on master, reads the version from `CMakeLists.txt` and creates a `vX.Y.Z` tag if it doesn't already exist
- **upload** stage: on tag push, creates a header-only tarball and publishes it to the GitLab package registry
- **release** stage: on tag push, creates a GitLab release linked to the package
- **upload** stage: creates a header-only tarball and publishes it to the GitLab package registry
- **release** stage: creates a GitLab release linked to the package

To cut a new release, just bump the version in `CMakeLists.txt` and merge to master — CI does the rest:
To cut a new release:

```bash
# 1. Update the VERSION in CMakeLists.txt
#    project(cppduals VERSION 0.7.1 ...)

# 2. Commit and merge to master — CI auto-tags and releases
git commit -am "Bump version to 0.7.1"
git push origin master
# 2. Commit the version bump and merge to master

# 3. Tag and push — CI does the rest
git tag v0.7.1
git push origin v0.7.1
```

**IMPORTANT:** After merging an MR that bumps the version, you must manually push a tag matching `vX.Y.Z` to trigger the release pipeline. The tag name must match the version in `CMakeLists.txt`.

## Code Conventions

- Comment WHY, not WHAT.
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#
cmake_minimum_required (VERSION 3.14)
project (cppduals
  VERSION 0.7.0
  VERSION 0.7.1
  LANGUAGES C CXX
  )
include (GNUInstallDirs)