Skip to content

Commit 51493e0

Browse files
committed
chore: update version to 0.4.1 in package.json
1 parent f1a5f6f commit 51493e0

2 files changed

Lines changed: 64 additions & 91 deletions

File tree

.github/workflows/publish.yml

Lines changed: 63 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Publish Extension to Visual Studio Marketplace
2-
run-name: ${{ inputs.dry_run && '🧪 Test publish workflow' || format('Validate, 🚀 Publish and Post-Process triggered from `{0}` branch', github.ref_name) }}
2+
run-name: Publish VS Code Extension
33

44
on:
55
push:
6-
branches: [pipeline, main]
6+
branches: [main]
77
paths-ignore: ['.github/workflows/**']
88
workflow_dispatch:
99
inputs:
@@ -14,65 +14,68 @@ on:
1414

1515
jobs:
1616
validate:
17+
name: Validate Changes
1718
runs-on: ubuntu-latest
1819
outputs:
1920
should_publish: ${{ steps.changes.outputs.should_publish }}
2021
version: ${{ steps.version.outputs.current }}
2122
skip_reason: ${{ steps.changes.outputs.skip_reason }}
2223
has_code_changes: ${{ steps.changes.outputs.has_code_changes }}
24+
2325
steps:
2426
- name: Checkout code
2527
uses: actions/checkout@v4
2628
with:
27-
fetch-depth: 2 # For version diff check
29+
fetch-depth: 2
30+
- name: Checked out code
31+
run: |
32+
echo "✅ Code checked out. Current directory: $(pwd)"
33+
echo "Files:"
34+
ls -la
2835
2936
- name: Get version info
3037
id: version
3138
run: |
39+
echo "🔍 Reading package.json version..."
3240
CURRENT=$(node -p "require('./package.json').version")
3341
echo "current=$CURRENT" >> $GITHUB_OUTPUT
3442
echo "✨ Current version: $CURRENT"
43+
echo "📦 Package.json contents:"
44+
cat package.json
45+
- name: Version info
46+
run: |
47+
echo "Version info step complete."
3548
3649
- name: Analyze changes
3750
id: changes
3851
run: |
39-
# Get the version change status
52+
echo "🔎 Analyzing changes between commits..."
4053
VERSION_UPDATED=$(git diff HEAD^ HEAD -- package.json | grep -q '"version":' && echo "true" || echo "false")
41-
42-
# Get code changes (excluding docs and configuration)
4354
CODE_CHANGES=$(git diff --name-only HEAD^ HEAD | \
44-
grep -vE '\.(md|txt)$|^docs/|^\.github/|^\.vscode/|package\.json$' || echo "")
45-
46-
# Get documentation changes
55+
grep -vE '\\.(md|txt)$|^docs/|^\\.github/|^\\.vscode/|package\\.json$' || echo "")
4756
DOC_CHANGES=$(git diff --name-only HEAD^ HEAD | \
48-
grep -E '\.(md|txt)$|^docs/' || echo "")
49-
50-
# Output change detection results
57+
grep -E '\\.(md|txt)$|^docs/' || echo "")
5158
echo "has_code_changes=${CODE_CHANGES:+true}" >> $GITHUB_OUTPUT
5259
echo "has_doc_changes=${DOC_CHANGES:+true}" >> $GITHUB_OUTPUT
53-
54-
# Determine workflow action based on changes
60+
echo "Code changes: $CODE_CHANGES"
61+
echo "Doc changes: $DOC_CHANGES"
5562
if [[ "$VERSION_UPDATED" == "true" ]]; then
5663
if [[ -n "$CODE_CHANGES" ]]; then
57-
# Version bump with code changes - proceed with publish
5864
echo "should_publish=true" >> $GITHUB_OUTPUT
5965
echo "skip_reason=" >> $GITHUB_OUTPUT
6066
echo "✅ Publishing needed: Version update detected with code changes"
6167
else
62-
# Version bump without code changes - skip but warn
6368
echo "should_publish=false" >> $GITHUB_OUTPUT
6469
echo "skip_reason=Version update without code changes" >> $GITHUB_OUTPUT
6570
echo "⚠️ Version update detected but no code changes found"
6671
fi
6772
else
6873
if [[ -n "$CODE_CHANGES" ]]; then
69-
# Code changes without version bump - fail
7074
echo "should_publish=false" >> $GITHUB_OUTPUT
7175
echo "skip_reason=Code changes without version update" >> $GITHUB_OUTPUT
7276
echo "❌ Code changes detected without version update"
7377
exit 1
7478
else
75-
# No relevant changes - skip
7679
echo "should_publish=false" >> $GITHUB_OUTPUT
7780
if [[ -n "$DOC_CHANGES" ]]; then
7881
echo "skip_reason=Documentation only changes" >> $GITHUB_OUTPUT
@@ -83,8 +86,11 @@ jobs:
8386
fi
8487
fi
8588
fi
89+
- name: Analyze changes
90+
run: echo "Analyze changes step complete."
8691

8792
build-and-package:
93+
name: Build and Package
8894
needs: validate
8995
if: needs.validate.outputs.should_publish == 'true'
9096
runs-on: ubuntu-latest
@@ -95,30 +101,24 @@ jobs:
95101
- uses: actions/setup-node@v4
96102
with:
97103
node-version: '18'
98-
99104
- name: Install and build
100105
run: |
101106
npm ci
102107
npm run compile
103108
npm install -g @vscode/vsce
104-
105109
- name: Package extension
106110
id: package
107111
run: |
108112
VERSION="${{ needs.validate.outputs.version }}"
109113
VSIX_NAME="simple-coding-time-tracker-${VERSION}.vsix"
110-
111114
rm -f *.vsix
112115
vsce package
113-
114116
if [ ! -f "$VSIX_NAME" ]; then
115117
echo "::error::Failed to create VSIX package"
116118
exit 1
117119
fi
118-
119120
echo "path=$VSIX_NAME" >> $GITHUB_OUTPUT
120121
echo "✅ Package created: $VSIX_NAME"
121-
122122
- name: Upload artifact
123123
uses: actions/upload-artifact@v4
124124
with:
@@ -127,105 +127,78 @@ jobs:
127127
retention-days: 90
128128

129129
publish:
130+
name: Publish to Marketplace
130131
needs: [validate, build-and-package]
131132
runs-on: ubuntu-latest
132-
environment: VSC EXT
133+
# environment: vscode-marketplace
133134
outputs:
134135
status: ${{ steps.publish.outputs.status }}
135136
error_detail: ${{ steps.publish.outputs.error_detail }}
136-
steps:
137+
138+
steps:
137139
- name: Download package
138140
uses: actions/download-artifact@v4
139141
with:
140142
name: extension-v${{ needs.validate.outputs.version }}
141-
142143
- name: Install vsce
143144
run: npm install -g @vscode/vsce
144-
145+
- name: Diagnostic check
146+
run: |
147+
echo "🔍 Environment Information"
148+
echo "Node version: $(node -v)"
149+
echo "NPM version: $(npm -v)"
150+
echo "VSCE version: $(vsce --version)"
151+
echo "Package.json version: $(node -p 'require(\'./package.json\').version')"
152+
echo "Current directory: $(pwd)"
153+
ls -la
154+
- name: Diagnostic check
155+
run: echo "Diagnostic check complete."
156+
145157
- name: Publish to marketplace
146158
id: publish
147159
continue-on-error: true
148160
env:
149161
VSC_PAT: ${{ secrets.VSC_PAT }}
150162
run: |
163+
DRY_RUN="false"
164+
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.dry_run }}" == "true" ]]; then
165+
DRY_RUN="true"
166+
fi
151167
VERSION="${{ needs.validate.outputs.version }}"
152-
153-
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
154-
echo "✨ Dry run mode - simulating publish of v${VERSION}"
168+
echo "🔍 Publish v${VERSION} (dry=${DRY_RUN})"
169+
if [[ "$DRY_RUN" == "true" ]]; then
170+
echo "✨ Dry run - skipping actual publish"
155171
echo "status=success" >> $GITHUB_OUTPUT
156-
echo "This is a dry run - skipping actual publish" >> $GITHUB_STEP_SUMMARY
157172
exit 0
158173
fi
159-
160-
# Attempt to publish and capture output
174+
echo "🚀 Running vsce publish..."
161175
OUTPUT=$(vsce publish -p "$VSC_PAT" 2>&1)
162176
EXIT_CODE=$?
163-
177+
echo "📝 vsce publish output:"
178+
echo "$OUTPUT"
164179
if [ $EXIT_CODE -eq 0 ]; then
165180
echo "status=success" >> $GITHUB_OUTPUT
181+
echo "✅ Publish succeeded."
182+
elif [[ "$OUTPUT" == *"already exists"* ]]; then
183+
echo "status=exists" >> $GITHUB_OUTPUT
184+
echo "ℹ️ Version already exists."
166185
else
167-
# Check specific error cases
168-
if [[ "$OUTPUT" == *"already exists"* ]]; then
169-
echo "status=exists" >> $GITHUB_OUTPUT
170-
else
171-
echo "status=failed" >> $GITHUB_OUTPUT
172-
ERROR_DETAIL=$(echo "$OUTPUT" | grep -v "error" | tail -n 1)
173-
echo "error_detail=$ERROR_DETAIL" >> $GITHUB_OUTPUT
174-
fi
186+
echo "status=failed" >> $GITHUB_OUTPUT
187+
ERROR_DETAIL=$(echo "$OUTPUT" | grep -v "error" | tail -n 1)
188+
echo "error_detail=$ERROR_DETAIL" >> $GITHUB_OUTPUT
189+
echo "❌ Publish failed: $ERROR_DETAIL"
175190
fi
176-
191+
- name: Publish step
192+
run: echo "Publish step complete."
193+
177194
- name: Create and push Git tag
178195
if: steps.publish.outputs.status == 'success'
179196
run: |
180197
VERSION="${{ needs.validate.outputs.version }}"
198+
echo "🏷️ Creating git tag v${VERSION}..."
181199
git config --global user.email "github-actions[bot]@users.noreply.github.com"
182200
git config --global user.name "GitHub Actions"
183201
git tag -a "v${VERSION}" -m "Release v${VERSION}"
184202
git push origin "v${VERSION}"
203+
echo "✅ Git tag pushed."
185204
186-
# Wrote this to update the run-name dynamically based on the publish status, but it is not supported in GitHub Actions now.
187-
# We can post the new extension publish in linked or comment on the PR.
188-
# https://github.com/orgs/community/discussions/69476
189-
post-process:
190-
needs: [validate, publish]
191-
if: always()
192-
runs-on: ubuntu-latest
193-
name: ${{ needs.validate.outputs.should_publish == 'false'
194-
&& format('{0} {1}',
195-
needs.validate.outputs.has_code_changes == 'true' && '⚠️' || 'ℹ️',
196-
needs.validate.outputs.skip_reason) || needs.publish.result == 'success'
197-
&& needs.publish.outputs.status == 'success'
198-
&& format('✅ Published v{0} successfully', needs.validate.outputs.version) || needs.publish.outputs.status == 'exists'
199-
&& format('ℹ️ v{0} already exists', needs.validate.outputs.version) || format('❌ Failed to publish v{0}', needs.validate.outputs.version) }}
200-
steps:
201-
- name: Set status summary
202-
run: |
203-
VERSION="${{ needs.validate.outputs.version }}"
204-
205-
# Set step summary only
206-
if [[ "${{ needs.validate.outputs.should_publish }}" == "false" ]]; then
207-
if [[ "${{ needs.validate.outputs.has_code_changes }}" == "true" ]]; then
208-
echo "### ⚠️ Version update needed for code changes" >> $GITHUB_STEP_SUMMARY
209-
else
210-
echo "### ℹ️ Documentation update only" >> $GITHUB_STEP_SUMMARY
211-
fi
212-
echo "${{ needs.validate.outputs.skip_reason }}" >> $GITHUB_STEP_SUMMARY
213-
elif [[ "${{ needs.publish.result }}" == "success" ]]; then
214-
case "${{ needs.publish.outputs.status }}" in
215-
"success")
216-
echo "### ✅ Published v${VERSION} successfully" >> $GITHUB_STEP_SUMMARY
217-
echo "Extension successfully published to VS Code Marketplace" >> $GITHUB_STEP_SUMMARY
218-
;;
219-
"exists")
220-
echo "### ℹ️ v${VERSION} already exists" >> $GITHUB_STEP_SUMMARY
221-
echo "Version already exists in VS Code Marketplace" >> $GITHUB_STEP_SUMMARY
222-
;;
223-
*)
224-
echo "### ❌ Failed to publish v${VERSION}" >> $GITHUB_STEP_SUMMARY
225-
echo "${{ needs.publish.outputs.error_detail }}" >> $GITHUB_STEP_SUMMARY
226-
;;
227-
esac
228-
else
229-
echo "### ❌ Failed to publish v${VERSION}" >> $GITHUB_STEP_SUMMARY
230-
echo "Workflow failed during publish stage" >> $GITHUB_STEP_SUMMARY
231-
fi

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "simple-coding-time-tracker",
33
"displayName": "Simple Coding Time Tracker",
44
"description": "Track and visualize your coding time across projects",
5-
"version": "0.4.0",
5+
"version": "0.4.1",
66
"publisher": "noorashuvo",
77
"license": "MIT",
88
"icon": "icon-sctt.png",

0 commit comments

Comments
 (0)