Skip to content

Commit e6af960

Browse files
committed
updated workflows
1 parent 36810a1 commit e6af960

2 files changed

Lines changed: 34 additions & 20 deletions

File tree

.github/workflows/release-v1-beta-core.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Release CLI Core (v1 Beta)
33
on:
44
push:
55
branches: [v1-beta]
6+
paths:
7+
- 'packages/contentstack/package.json'
68

79
jobs:
810
build:
@@ -55,16 +57,15 @@ jobs:
5557
if: ${{ steps.publish-core.conclusion == 'success' }}
5658
id: create_release
5759
env:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
GITHUB_TOKEN: ${{ secrets.PKG_TOKEN }}
5961
VERSION: ${{ steps.publish-core.outputs.version }}
6062
run: |
61-
# Look for the last release specifically starting with the 'core@v' prefix
62-
PREVIOUS_BETA=$(gh release list --limit 50 | grep 'core@v' | grep 'beta' | head -1 | cut -f1)
63-
64-
if [ -n "$PREVIOUS_BETA" ]; then
65-
# Compare current core version against previous core version
66-
gh release create "core@v$VERSION" --title "Core Beta $VERSION" --notes-from-tag "$PREVIOUS_BETA" --prerelease
63+
TAG="core@v${VERSION}"
64+
if gh release view "$TAG" &>/dev/null; then
65+
echo "Release $TAG already exists — skipping."
6766
else
68-
# Fallback if this is the first core@v release
69-
gh release create "core@v$VERSION" --title "Core Beta $VERSION" --generate-notes --prerelease
67+
gh release create "$TAG" \
68+
--title "Core Beta $VERSION" \
69+
--generate-notes \
70+
--prerelease
7071
fi

.github/workflows/release-v1-beta-platform-plugins.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,33 @@ jobs:
122122
package: ./packages/contentstack-auth/package.json
123123
tag: beta
124124

125+
- name: Read platform plugins version
126+
id: plugins-version
127+
if: >-
128+
${{
129+
steps.dev-dependencies-installation.conclusion == 'success' ||
130+
steps.utilities-installation.conclusion == 'success' ||
131+
steps.command-installation.conclusion == 'success' ||
132+
steps.config-installation.conclusion == 'success' ||
133+
steps.auth-installation.conclusion == 'success'
134+
}}
135+
run: |
136+
VERSION=$(jq -r .version ./package.json)
137+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
138+
125139
- name: Create Platform Plugins Beta Release
126-
# Adjust the ID below to match your actual publishing step ID for plugins
127-
if: ${{ steps.publish-plugins.conclusion == 'success' }}
140+
if: ${{ steps.plugins-version.conclusion == 'success' }}
128141
id: create_release_plugins
129142
env:
130-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131-
# Extract version from the output of your plugin publish step
132-
VERSION: ${{ steps.publish-plugins.outputs.version }}
143+
GITHUB_TOKEN: ${{ secrets.PKG_TOKEN }}
144+
VERSION: ${{ steps.plugins-version.outputs.version }}
133145
run: |
134-
# Look for the last release specifically starting with 'plugins@v'
135-
PREVIOUS_BETA=$(gh release list --limit 50 | grep 'platform-plugins@v' | grep 'beta' | head -1 | cut -f1)
136-
137-
if [ -n "$PREVIOUS_BETA" ]; then
138-
gh release create "platform-plugins@v$VERSION" --title "Platform Plugins Beta $VERSION" --notes-from-tag "$PREVIOUS_BETA" --prerelease
146+
TAG="platform-plugins@v${VERSION}"
147+
if gh release view "$TAG" &>/dev/null; then
148+
echo "Release $TAG already exists — skipping."
139149
else
140-
gh release create "platform-plugins@v$VERSION" --title "Platform Plugins Beta $VERSION" --generate-notes --prerelease
150+
gh release create "$TAG" \
151+
--title "Platform Plugins Beta $VERSION" \
152+
--generate-notes \
153+
--prerelease
141154
fi

0 commit comments

Comments
 (0)