mctools / simplebuild

A very simple to use build system for projects with primarily C++/Python code, intended for usage by scientific developers without a strong SW-engineering background.
https://mctools.github.io/simplebuild/
Apache License 2.0
3 stars 1 forks source link

Fix version if installing from git archive #48

Closed tkittel closed 6 months ago

tkittel commented 7 months ago

Perhaps init.py (or a version.txt) file next to it could have a tag description embedded, like here:

https://git-scm.com/docs/gitattributes

That would provide versioning even for the case where a downloaded archive is pip install'ed.

However, this does not actually change the package meta data, so is not a complete solution.

tkittel commented 7 months ago

Saving WIP (unfinished!) workflow stuff here:

name: add-version-tag
on:
  push:
    branches:
      - main
    paths:
      - src/_simple_build_system/data/version.txt

jobs:
  add_vtag:
    runs-on: ubuntu-latest
    #permissions:
    #  id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        #Note: We get all history and tags, to be sure we do not miss anything:
        with:
          fetch-depth: 0

      - name: Update tag
        run: |
          set -eux
          test -f src/_simple_build_system/data/version.txt
          export NEWVTAG="v$(cat src/_simple_build_system/data/version.txt)"
          if [ $(git tag -l "$NEWVTAG") ]; then echo "ERROR: Tag already exists: '$NEWTAGVAL'"; false; fi

Also add the version.txt file of course (also to MANIFEST.in)

tkittel commented 6 months ago

The ideas in the previous comments are valid, but will probably not be needed for this project. Closing.