From 139e16618b232af2d1509fb0869559f7a3978c34 Mon Sep 17 00:00:00 2001 From: edraft Date: Mon, 15 Sep 2025 17:09:10 +0200 Subject: [PATCH] Updated ci --- .gitea/workflows/build_dev.yaml | 11 +++++------ .gitea/workflows/package.yaml | 16 ++++++++-------- .gitea/workflows/prepare.yaml | 24 ++++++++++++++++++++++-- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/build_dev.yaml b/.gitea/workflows/build_dev.yaml index fc1b35a7..47bbb951 100644 --- a/.gitea/workflows/build_dev.yaml +++ b/.gitea/workflows/build_dev.yaml @@ -10,20 +10,19 @@ jobs: uses: ./.gitea/workflows/prepare.yaml with: version_suffix: 'dev' + working_directory: src/cpl_core secrets: inherit core: needs: prepare uses: ./.gitea/workflows/package.yaml - defaults: - run: - working-directory: src/cpl_core + with: + working_directory: src/cpl_core secrets: inherit query: needs: prepare uses: ./.gitea/workflows/package.yaml - defaults: - run: - working-directory: src/cpl_query + with: + working_directory: src/cpl_query secrets: inherit \ No newline at end of file diff --git a/.gitea/workflows/package.yaml b/.gitea/workflows/package.yaml index e802e0f9..5a8598df 100644 --- a/.gitea/workflows/package.yaml +++ b/.gitea/workflows/package.yaml @@ -8,12 +8,17 @@ on: description: 'Suffix for version (z.B. "dev", "alpha", "beta")' required: false type: string + working_directory: + required: true + type: string jobs: build: runs-on: [ runner ] container: git.sh-edraft.de/sh-edraft.de/act-runner:latest - + defaults: + run: + working-directory: ${{ inputs.working_directory }} steps: - name: Clone Repository uses: https://github.com/actions/checkout@v3 @@ -27,12 +32,7 @@ jobs: - name: Set version run: | - VERSION_SUFFIX="${{ inputs.version_suffix }}" - if [ -n "$VERSION_SUFFIX" ]; then - sed -i -E "s/^version = \".*\"/version = \"$(cat version.txt)-$VERSION_SUFFIX\"/" pyproject.toml - else - sed -i -E "s/^version = \".*\"/version = \"$(cat version.txt)\"/" pyproject.toml - fi + sed -i -E "s/^version = \".*\"/version = \"$(cat version.txt)\"/" pyproject.toml - name: Install Dependencies run: | @@ -40,7 +40,7 @@ jobs: - name: Build Package run: | - python -m build --sdist --wheel --outdir dist + python -m build --outdir dist - name: Login to registry git.sh-edraft.de uses: https://github.com/docker/login-action@v1 diff --git a/.gitea/workflows/prepare.yaml b/.gitea/workflows/prepare.yaml index 0ef54f3a..6633be15 100644 --- a/.gitea/workflows/prepare.yaml +++ b/.gitea/workflows/prepare.yaml @@ -3,11 +3,22 @@ run-name: Prepare Build Version on: workflow_call: + inputs: + version_suffix: + description: 'Suffix for version (z.B. "dev", "alpha", "beta")' + required: false + type: string + working_directory: + required: true + type: string jobs: prepare: runs-on: [ runner ] container: git.sh-edraft.de/sh-edraft.de/act-runner:latest + defaults: + run: + working-directory: ${{ inputs.working_directory }} steps: - name: Clone Repository uses: https://github.com/actions/checkout@v3 @@ -21,7 +32,16 @@ jobs: DATE=$(date +'%Y.%m.%d') TAG_COUNT=$(git tag -l "${DATE}.*" | wc -l) BUILD_NUMBER=$(($TAG_COUNT + 1)) - BUILD_VERSION="${DATE}.${BUILD_NUMBER}.dev1" + + VERSION_SUFFIX="${{ inputs.version_suffix }}" + if [ -n "$VERSION_SUFFIX" ] && [[ "$VERSION_SUFFIX" == "dev" ]]; then + BUILD_VERSION="${DATE}.dev${BUILD_NUMBER}" + elif [ -n "$VERSION_SUFFIX" ]; then + BUILD_VERSION="${DATE}.${BUILD_NUMBER}${VERSION_SUFFIX}" + else + BUILD_VERSION="${DATE}.${BUILD_NUMBER}" + fi + echo "$BUILD_VERSION" > version.txt echo "VERSION $BUILD_VERSION" @@ -37,4 +57,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: version - path: version.txt \ No newline at end of file + path: ${{ inputs.working_directory }}/version.txt \ No newline at end of file