Skip to content

Commit cedb480

Browse files
committed
ci(smartem-epuplayer): add version validation and rename workflow
1 parent 9619c10 commit cedb480

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

.github/workflows/release-epuplayer.yml renamed to .github/workflows/release-smartem-epuplayer.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: EPUPlayer Release
1+
name: Release smartem-epuplayer
22

33
on:
44
push:
55
branches: [main]
66
tags: ['epuplayer-v*']
77
paths:
88
- 'packages/smartem-epuplayer/**'
9-
- '.github/workflows/release-epuplayer.yml'
9+
- '.github/workflows/release-smartem-epuplayer.yml'
1010
pull_request:
1111
paths:
1212
- 'packages/smartem-epuplayer/**'
13-
- '.github/workflows/release-epuplayer.yml'
13+
- '.github/workflows/release-smartem-epuplayer.yml'
1414
workflow_dispatch:
1515
inputs:
1616
release_type:
@@ -41,6 +41,8 @@ jobs:
4141
steps:
4242
- name: Checkout repository
4343
uses: actions/checkout@v6
44+
with:
45+
fetch-depth: 0
4446

4547
- name: Determine version
4648
id: version
@@ -49,6 +51,16 @@ jobs:
4951
BASE_VERSION=$(grep -m1 'version = ' $PACKAGE_DIR/pyproject.toml | sed 's/version = "\(.*\)"/\1/')
5052
echo "Base version: $BASE_VERSION"
5153
54+
# Validate version matches __init__.py
55+
INIT_VERSION=$(grep -m1 '__version__ = ' $PACKAGE_DIR/smartem_epuplayer/__init__.py | sed 's/__version__ = "\(.*\)"/\1/')
56+
echo "Init version: $INIT_VERSION"
57+
58+
if [[ "$BASE_VERSION" != "$INIT_VERSION" ]]; then
59+
echo "::error::Version mismatch! pyproject.toml=$BASE_VERSION, __init__.py=$INIT_VERSION"
60+
exit 1
61+
fi
62+
echo "Version validation passed: $BASE_VERSION"
63+
5264
IS_STABLE="false"
5365
IS_RC="false"
5466
SHOULD_RELEASE="false"
@@ -64,10 +76,20 @@ jobs:
6476
IS_STABLE="true"
6577
SHOULD_RELEASE="true"
6678
elif [[ "$GITHUB_REF" == refs/heads/main ]]; then
67-
# RC release on push to main
68-
VERSION="${BASE_VERSION}rc${{ github.run_number }}"
69-
IS_RC="true"
70-
SHOULD_RELEASE="true"
79+
# Check if stable tag already exists for this version
80+
STABLE_TAG="epuplayer-v${BASE_VERSION}"
81+
if git tag -l "$STABLE_TAG" | grep -q "$STABLE_TAG"; then
82+
echo "Stable tag $STABLE_TAG already exists. Skipping RC release."
83+
VERSION="$BASE_VERSION"
84+
IS_RC="false"
85+
IS_STABLE="false"
86+
SHOULD_RELEASE="false"
87+
else
88+
# RC release on push to main
89+
VERSION="${BASE_VERSION}rc${{ github.run_number }}"
90+
IS_RC="true"
91+
SHOULD_RELEASE="true"
92+
fi
7193
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
7294
if [[ "${{ inputs.release_type }}" == "stable" ]]; then
7395
VERSION="$BASE_VERSION"

0 commit comments

Comments
 (0)