Skip to content

Commit 44f2861

Browse files
author
rahul-infra
committed
updated release preview file.
1 parent da76791 commit 44f2861

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

.github/workflows/release-preview.yaml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,38 @@ jobs:
3636

3737
- name: Install semantic-release
3838
run: |
39-
npm install -g semantic-release@18.0.0 \
39+
npm install --save-dev semantic-release@18.0.0 \
4040
@semantic-release/commit-analyzer@9.0.2 \
4141
@semantic-release/release-notes-generator@10.0.3 \
42-
@semantic-release/github@8.0.7 \
4342
conventional-changelog-conventionalcommits@4.6.3
4443
44+
- name: Create preview config
45+
run: |
46+
# Create a config without GitHub plugin for preview (avoids token validation)
47+
cat > .releaserc.preview.json << 'EOF'
48+
{
49+
"branches": ["main"],
50+
"plugins": [
51+
"@semantic-release/commit-analyzer",
52+
"@semantic-release/release-notes-generator"
53+
]
54+
}
55+
EOF
56+
4557
- name: Run semantic-release (dry-run)
4658
id: semantic
4759
run: |
48-
# Run semantic-release in dry-run mode and capture output
49-
# Override branch config to treat current branch as 'main'
50-
OUTPUT=$(npx semantic-release --dry-run --no-ci --branches main 2>&1 || true)
60+
# Temporarily rename main config to use preview config only
61+
mv .releaserc.json .releaserc.json.bak
62+
63+
# Run semantic-release in dry-run mode with preview config only
64+
OUTPUT=$(npx semantic-release --extends ./.releaserc.preview.json --dry-run --no-ci 2>&1 || true)
5165
echo "$OUTPUT"
5266
53-
# Extract version information (compatible with both GNU and BSD grep)
67+
# Restore main config
68+
mv .releaserc.json.bak .releaserc.json
69+
70+
# Extract version information
5471
NEW_VERSION=$(echo "$OUTPUT" | grep -Eo "The next release version is [0-9]+\.[0-9]+\.[0-9]+" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" || echo "")
5572
RELEASE_TYPE=$(echo "$OUTPUT" | grep -Eo "Analysis of [0-9]+ commits complete: [a-z]+ release" | grep -Eo "(major|minor|patch) release" | sed 's/ release//' || echo "")
5673
@@ -62,10 +79,6 @@ jobs:
6279
echo "full_output<<EOF" >> $GITHUB_OUTPUT
6380
echo "$OUTPUT" >> $GITHUB_OUTPUT
6481
echo "EOF" >> $GITHUB_OUTPUT
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-
GITHUB_REF: refs/heads/main
68-
GITHUB_REF_NAME: main
6982
7083
- name: Display Preview
7184
run: |

0 commit comments

Comments
 (0)