Skip to content

Commit

Permalink
ci: add current git sha to version in build-wheel job
Browse files Browse the repository at this point in the history
  • Loading branch information
afuetterer committed Dec 2, 2023
1 parent de67387 commit 1ef270c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ 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_SHA)" >> $GITHUB_OUTPUT
- name: Get current version (MAJOR.MINOR.PATCH)
id: current-version
run: echo "current_version=$(grep -Po "[\d.]+" rdmo/__init__.py)" >> $GITHUB_OUTPUT
- name: Add SHA as suffix to version
run: |
NEW_VERSION="${{ steps.current-version.outputs.current_version }}.dev0+${{ steps.short-sha.outputs.sha }}"
sed -i "s/__version__ = .*/__version__ = \"$NEW_VERSION\"/" rdmo/__init__.py
- run: cat rdmo/__init__.py
- uses: actions/setup-node@v4
with:
node-version: 18
Expand All @@ -143,11 +154,6 @@ jobs:
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
with:
name: wheel
Expand Down

0 comments on commit 1ef270c

Please sign in to comment.