11name : Publish Tricorder Package
22
33on :
4- # Trigger on version tags for tricorder
4+ # Trigger on version tags for tricorder (supports both formats)
55 push :
66 tags :
77 - ' tricorder-v*.*.*'
8+ - ' @tuvixrss/tricorder@*.*.*'
89
910 # Manual trigger with version input
1011 workflow_dispatch :
@@ -114,7 +115,20 @@ jobs:
114115 - name : Verify version matches tag
115116 if : startsWith(github.ref, 'refs/tags/')
116117 run : |
117- TAG_VERSION=${GITHUB_REF#refs/tags/tricorder-v}
118+ TAG_REF=${GITHUB_REF#refs/tags/}
119+
120+ # Extract version from either format:
121+ # - tricorder-vX.Y.Z -> X.Y.Z
122+ # - @tuvixrss/tricorder@X.Y.Z -> X.Y.Z
123+ if [[ "$TAG_REF" =~ ^tricorder-v(.+)$ ]]; then
124+ TAG_VERSION="${BASH_REMATCH[1]}"
125+ elif [[ "$TAG_REF" =~ ^@tuvixrss/tricorder@(.+)$ ]]; then
126+ TAG_VERSION="${BASH_REMATCH[1]}"
127+ else
128+ echo "❌ Invalid tag format: $TAG_REF"
129+ echo "Expected format: tricorder-vX.Y.Z or @tuvixrss/tricorder@X.Y.Z"
130+ exit 1
131+ fi
118132
119133 # Validate semantic version format (major.minor.patch with optional pre-release)
120134 if ! echo "$TAG_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$'; then
@@ -128,7 +142,8 @@ jobs:
128142
129143 if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
130144 echo "❌ Version mismatch!"
131- echo "Git tag version: $TAG_VERSION"
145+ echo "Git tag: $TAG_REF"
146+ echo "Extracted version: $TAG_VERSION"
132147 echo "package.json version: $PACKAGE_VERSION"
133148 exit 1
134149 fi
@@ -164,7 +179,19 @@ jobs:
164179 uses : actions/github-script@v7
165180 with :
166181 script : |
167- const version = context.ref.replace('refs/tags/tricorder-v', '');
182+ const tagRef = context.ref.replace('refs/tags/', '');
183+
184+ // Extract version from either format:
185+ // - tricorder-vX.Y.Z -> X.Y.Z
186+ // - @tuvixrss/tricorder@X.Y.Z -> X.Y.Z
187+ let version;
188+ if (tagRef.startsWith('tricorder-v')) {
189+ version = tagRef.replace('tricorder-v', '');
190+ } else if (tagRef.startsWith('@tuvixrss/tricorder@')) {
191+ version = tagRef.replace('@tuvixrss/tricorder@', '');
192+ } else {
193+ throw new Error(`Invalid tag format: ${tagRef}`);
194+ }
168195
169196 // Check if release already exists
170197 let releaseExists = false;
0 commit comments