From 00c639347c0bbc1b6044eaa1d6a282e1c7f36795 Mon Sep 17 00:00:00 2001 From: longstone <3483450-longstone@users.noreply.gitlab.com> Date: Wed, 24 Jan 2024 11:35:12 +0100 Subject: [PATCH] feat: create version bumping in ci (tag based) --- .VERSION | 1 + .github/workflows/build-publish.yml | 6 ++++++ .github/workflows/docker-image.yml | 8 +++++++- Dockerfile | 4 +++- README.md | 6 ++++-- setup.py | 2 +- 6 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 .VERSION diff --git a/.VERSION b/.VERSION new file mode 100644 index 0000000..ef5c481 --- /dev/null +++ b/.VERSION @@ -0,0 +1 @@ +5.0.0-dev \ No newline at end of file diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index e8beac7..99c682e 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -12,6 +12,12 @@ jobs: steps: - uses: actions/checkout@master + - name: Update version file ⬆️ + uses: brettdorrans/write-version-to-file@v1.1.0 + with: + filename: 'setup.py' + placeholder: 'latest-dev' + - name: Set up Python 3.10 uses: actions/setup-python@v3 with: diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 585ae85..094e127 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -30,6 +30,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Update version file ⬆️ + uses: brettdorrans/write-version-to-file@v1.1.0 + with: + filename: 'setup.py' + placeholder: 'latest-dev' + - name: Log in to the Container registry uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: @@ -43,7 +49,7 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image + - name: Build and push Docker image 📦 to ghcr uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: context: . diff --git a/Dockerfile b/Dockerfile index 7017e13..ea3e7eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,9 @@ RUN apk add --no-cache --virtual .build-deps \ apk add --no-cache libxslt libxml2 RUN mkdir -p /src -COPY . /src +COPY ./withings_sync /src +COPY ./setup.py /src +COPY ./.VERSION /src RUN cd /src && \ python3 ./setup.py install diff --git a/README.md b/README.md index 9b4cb38..8fa5db2 100644 --- a/README.md +++ b/README.md @@ -252,15 +252,17 @@ This will run the job every 3 hours (at a random minute) and writing the output Release works via the GitHub [Draft a new Release](https://github.com/jaroslawhartman/withings-sync/releases/new) function. -Keep in mind to bump the `version` key in `setup.py`. +The `version` key in `setup.py` will be bumped automatically (Version will be written to .VERSION file). +Keep in mind to update the `.VERSION` if a major release is done. ### Docker Image An image is created magically by GitHub Action and published to [ghcr](https://github.com/jaroslawhartman/withings-sync/pkgs/container/withings-sync). -### pypi +### Manual release: pypi +Will be conducted automatically within the Github-Release cycle. You'll find a script to create and upload a release to pypi here `contrib/do_release.sh`. It requires [twine](https://pypi.org/project/twine/). This needs the permission on the [pypi-project](https://pypi.org/project/withings-sync/). diff --git a/setup.py b/setup.py index ce39792..c5d8bff 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ def read(fname): setup( name="withings-sync", - version="4.2.4", + version=read(".VERSION"), author="Masayuki Hamasaki, Steffen Vogel", author_email="post@steffenvogel.de", description="A tool for synchronisation of Withings (ex. Nokia Health Body) to Garmin Connect and Trainer Road.",