Skip to content

Commit 5e860e1

Browse files
authored
Merge pull request #10 from getcodesetu/codex-ide-feature-foundation
Now both workflows read the full version directly from the manifest:
2 parents 632836c + 9f074bf commit 5e860e1

2 files changed

Lines changed: 24 additions & 20 deletions

File tree

‎.github/workflows/release-jetbrains.yml‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,22 @@ jobs:
4242
- name: Compute version
4343
id: version
4444
run: |
45-
MAJOR_MINOR=$(grep '^pluginVersion=' apps/jetbrains/gradle.properties | cut -d= -f2 | cut -d. -f1-2)
46-
VERSION="${MAJOR_MINOR}.${{ github.run_number }}"
45+
# Full version is read from apps/jetbrains/gradle.properties (single source of truth).
46+
# Bump pluginVersion in a commit before running this workflow.
47+
VERSION=$(grep '^pluginVersion=' apps/jetbrains/gradle.properties | cut -d= -f2)
48+
TAG="jetbrains-v${VERSION}"
49+
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null \
50+
|| git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
51+
echo "::error::Tag ${TAG} already exists. Bump pluginVersion in apps/jetbrains/gradle.properties before releasing."
52+
exit 1
53+
fi
4754
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
48-
echo "tag=jetbrains-v${VERSION}" >> "$GITHUB_OUTPUT"
49-
echo "Computed version: ${VERSION}"
55+
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
56+
echo "Releasing version: ${VERSION}"
5057
5158
- name: Build and verify plugin
5259
working-directory: apps/jetbrains
53-
run: ./gradlew -PpluginVersion=${{ steps.version.outputs.version }} buildPlugin verifyPlugin --no-daemon
60+
run: ./gradlew buildPlugin verifyPlugin --no-daemon
5461

5562
- name: Verify plugin zip exists
5663
run: |
@@ -67,7 +74,7 @@ jobs:
6774
working-directory: apps/jetbrains
6875
env:
6976
JETBRAINS_MARKETPLACE_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }}
70-
run: ./gradlew -PpluginVersion=${{ steps.version.outputs.version }} publishPlugin --no-daemon
77+
run: ./gradlew publishPlugin --no-daemon
7178

7279
- name: Configure git for tagging
7380
if: ${{ !inputs.dry-run }}
@@ -99,7 +106,6 @@ jobs:
99106
echo ""
100107
echo "- Version: \`${{ steps.version.outputs.version }}\`"
101108
echo "- Tag: \`${{ steps.version.outputs.tag }}\`"
102-
echo "- Run number: \`${{ github.run_number }}\`"
103109
if [ "${{ inputs.dry-run }}" = "true" ]; then
104110
echo "- Mode: **dry-run** (no publish, no tag pushed, no GitHub Release)"
105111
fi

‎.github/workflows/release-vscode.yml‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,18 @@ jobs:
4141
- name: Compute version
4242
id: version
4343
run: |
44-
# Major.minor is read from apps/vscode/package.json (single source of truth).
45-
# Patch is the GitHub Actions run_number for this workflow (monotonic, never resets).
46-
MAJOR_MINOR=$(node -p "require('./apps/vscode/package.json').version.split('.').slice(0,2).join('.')")
47-
VERSION="${MAJOR_MINOR}.${{ github.run_number }}"
44+
# Full version is read from apps/vscode/package.json (single source of truth).
45+
# Bump it in a commit before running this workflow.
46+
VERSION=$(node -p "require('./apps/vscode/package.json').version")
47+
TAG="vscode-v${VERSION}"
48+
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null \
49+
|| git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
50+
echo "::error::Tag ${TAG} already exists. Bump apps/vscode/package.json before releasing."
51+
exit 1
52+
fi
4853
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
49-
echo "tag=vscode-v${VERSION}" >> "$GITHUB_OUTPUT"
50-
echo "Computed version: ${VERSION}"
51-
52-
- name: Apply version to manifest (workspace only, not committed)
53-
working-directory: apps/vscode
54-
run: npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version
54+
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
55+
echo "Releasing version: ${VERSION}"
5556
5657
- name: Install dependencies
5758
run: pnpm install --frozen-lockfile
@@ -89,8 +90,6 @@ jobs:
8990
- name: Tag the release commit
9091
if: ${{ !inputs.dry-run }}
9192
run: |
92-
# Discard the in-workspace version bump so the tag points at the original commit.
93-
git checkout apps/vscode/package.json
9493
git tag "${{ steps.version.outputs.tag }}"
9594
git push origin "${{ steps.version.outputs.tag }}"
9695
@@ -112,7 +111,6 @@ jobs:
112111
echo ""
113112
echo "- Version: \`${{ steps.version.outputs.version }}\`"
114113
echo "- Tag: \`${{ steps.version.outputs.tag }}\`"
115-
echo "- Run number: \`${{ github.run_number }}\`"
116114
if [ "${{ inputs.dry-run }}" = "true" ]; then
117115
echo "- Mode: **dry-run** (nothing published, no tag pushed)"
118116
fi

0 commit comments

Comments
 (0)