Skip to content

Commit f2cd256

Browse files
committed
Alter CI
1 parent 9f9697e commit f2cd256

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

.github/get-version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import importlib.metadata
22

3-
print(importlib.metadata.version('infrahub-sdk'))
3+
print(importlib.metadata.version('infrahub-sdk'))

.github/workflows/release.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ jobs:
4141
- name: "Check prerelease type"
4242
id: release
4343
run: |
44-
echo is_prerelease=$(uv run python -c "from packaging.version import Version; print(int(Version('$(uv run .github/get-version.py)').is_prerelease))") >> "$GITHUB_OUTPUT"
45-
echo is_devrelease=$(uv run python -c "from packaging.version import Version; print(int(Version('$(uv run .github/get-version.py)').is_devrelease))") >> "$GITHUB_OUTPUT"
46-
echo "version=$(uv run .github/get-version.py)" >> "$GITHUB_OUTPUT"
47-
echo major_minor_version=$(uv run python -c "from packaging.version import Version; print(f\"{Version('$(uv run .github/get-version.py)').major}.{Version('$(uv run .github/get-version.py)').minor}\")") >> "$GITHUB_OUTPUT" echo latest_tag=$(curl -L \
48-
-H "Accept: application/vnd.github+json" \
49-
-H "Authorization: Bearer ${{ github.token }}" \
50-
-H "X-GitHub-Api-Version: 2022-11-28" \
51-
https://api.github.com/repos/${{ github.repository }}/releases/latest \
52-
| jq -r '.tag_name') >> "$GITHUB_OUTPUT"
44+
VERSION=$(uv run .github/get-version.py)
45+
IS_PRERELEASE=$(uv run python -c "from packaging.version import Version; print(int(Version('$VERSION').is_prerelease))")
46+
IS_DEVRELEASE=$(uv run python -c "from packaging.version import Version; print(int(Version('$VERSION').is_devrelease))")
47+
MAJOR_MINOR_VERSION=$(uv run python -c "from packaging.version import Version; v = Version('$VERSION'); print(f'{v.major}.{v.minor}')")
48+
LATEST_TAG=$(curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ github.token }}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
49+
50+
echo "is_prerelease=$IS_PRERELEASE" >> "$GITHUB_OUTPUT"
51+
echo "is_devrelease=$IS_DEVRELEASE" >> "$GITHUB_OUTPUT"
52+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
53+
echo "major_minor_version=$MAJOR_MINOR_VERSION" >> "$GITHUB_OUTPUT"
54+
echo "latest_tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
55+
5356
5457
- name: Check tag version
5558
if: github.event.release.tag_name != format('v{0}', steps.release.outputs.version)

0 commit comments

Comments
 (0)