From 9f1fcac630470824b9310df95593edd8338b75b0 Mon Sep 17 00:00:00 2001 From: Heinz-Alexander Fuetterer Date: Fri, 1 Dec 2023 19:01:22 +0100 Subject: [PATCH 1/2] chore: remove obsolete VERSION variable --- rdmo/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdmo/__init__.py b/rdmo/__init__.py index 5e8b7ade92..0309ae290b 100644 --- a/rdmo/__init__.py +++ b/rdmo/__init__.py @@ -1 +1 @@ -VERSION = __version__ = "2.0.2" +__version__ = "2.0.2" From bc88b9a4e7cf00434cd190faa1ff0454a460b3c5 Mon Sep 17 00:00:00 2001 From: Heinz-Alexander Fuetterer Date: Fri, 1 Dec 2023 19:13:21 +0100 Subject: [PATCH 2/2] ci: add current git sha to version in build-wheel job --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82b684675d..dedaff6394 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -137,6 +137,18 @@ jobs: if: github.event_name == 'pull_request' steps: - uses: actions/checkout@v4 + - name: Get short commit SHA + id: short-sha + run: echo "sha=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT + - name: Get current version (MAJOR.MINOR.PATCH) + id: current-version + run: echo "current_version=$(grep -Po '(?<=__version__ = ")[\d\w.]+(?=")' rdmo/__init__.py)" >> $GITHUB_OUTPUT + - name: Generate new version (current version + SHA) + id: new-version + run: echo "new_version=${{ steps.current-version.outputs.current_version }}+${{ steps.short-sha.outputs.sha }}" >> $GITHUB_OUTPUT + - name: Update version in rdmo/__init__.py + run: | + sed -i "s/__version__ = .*/__version__ = \"${{ steps.new-version.outputs.new_version }}\"/" rdmo/__init__.py - uses: actions/setup-node@v4 with: node-version: 18 @@ -147,17 +159,27 @@ jobs: with: python-version: '3.12' cache: pip - - run: python -m pip install --upgrade build pip setuptools wheel - - run: python -m build --wheel - - run: | - PR_NUMBER=${{ github.event.pull_request.number }} - WHL_FILE=$(ls dist/*.whl) - NEW_NAME="${WHL_FILE/-py3-none-any/dev${PR_NUMBER}-py3-none-any}" - mv "$WHL_FILE" "$NEW_NAME" - - uses: actions/upload-artifact@v3 + - run: python -m pip install --upgrade build pip setuptools twine wheel + - name: Build the wheel + run: python -m build --wheel + - name: Check metadata + run: python -m twine check --strict dist/* + - name: Install package from built wheel + run: python -m pip install dist/rdmo*.whl + - name: Write info to step summary + run: | + echo -e "# ✓ Wheel successfully built (v${{ steps.new-version.outputs.new_version }})\n\n" >> $GITHUB_STEP_SUMMARY + echo "\`\`\`console" >> $GITHUB_STEP_SUMMARY + echo "$ python -m pip show rdmo" >> $GITHUB_STEP_SUMMARY + python -m pip show rdmo >> $GITHUB_STEP_SUMMARY + echo "\`\`\`" >> $GITHUB_STEP_SUMMARY + - name: Upload wheel as artifact + uses: actions/upload-artifact@v3 with: name: wheel - path: dist/*.whl + path: dist/rdmo*.whl + if-no-files-found: error + retention-days: 30 dev-setup: # Ref: structlog (MIT licensed)