Skip to content

Commit 6e1bd09

Browse files
authored
ci(cd): update version json file creation
1 parent 12b0f03 commit 6e1bd09

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

.github/workflows/check-version.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,32 @@ jobs:
3131

3232
- name: Install package dependencies
3333
run: npm ci
34-
35-
- name: Run Semantic Release
36-
id: version
34+
35+
- name: Run semantic-release in dry-run and save log
3736
run: |
38-
VERSION=$(npx semantic-release --dry-run | grep -oP 'The next release version is \K[0-9]+\.[0-9]+\.[0-9]+')
39-
echo "Extracted VERSION=$VERSION"
40-
echo "VERSION=$VERSION" >> $GITHUB_ENV
37+
npx semantic-release --dry-run > release.log || true
4138
env:
4239
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
40+
41+
- name: Extract next version from log
42+
id: extract_version
43+
run: |
44+
VERSION=$(grep -oP 'The next release version is \K[0-9]+\.[0-9]+\.[0-9]+' release.log || echo "unknown")
45+
echo "VERSION=$VERSION" >> $GITHUB_ENV
46+
echo "Extracted version: $VERSION"
4347
44-
- name: Create version-badge.json
48+
- name: Create organized-next.json
4549
run: |
46-
echo "{\"schemaVersion\":1,\"label\":\"next version\",\"message\":\"${VERSION}\",\"color\":\"blue\"}" > organized-next.json
50+
cat <<EOF > organized-next.json
51+
{
52+
"schemaVersion": 1,
53+
"label": "next version",
54+
"message": "${VERSION}",
55+
"color": "blue"
56+
}
57+
EOF
58+
env:
59+
VERSION: ${{ env.VERSION }}
4760

4861
- name: Update Gist with badge
4962
env:

0 commit comments

Comments
 (0)