Skip to content

Commit af3eb66

Browse files
committed
commit
1 parent 459aecf commit af3eb66

2 files changed

Lines changed: 39 additions & 23 deletions

File tree

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"Read(//tmp/**)",
1919
"Bash(git status -u)",
2020
"Bash(git status -u --short)",
21-
"Bash(git push origin main)"
21+
"Bash(git push origin main)",
22+
"Bash(node -e \"const p=require\\('./package.json'\\); console.log\\('deps:', Object.keys\\(p.dependencies||{}\\)\\); console.log\\('devDeps:', Object.keys\\(p.devDependencies||{}\\)\\); console.log\\('scripts:', Object.keys\\(p.scripts||{}\\)\\);\")"
2223
],
2324
"additionalDirectories": [
2425
"/tmp"

.github/workflows/publish.yml

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,57 @@
11
name: Publish Extension
22

3-
permissions:
4-
contents: read
3+
# main への push で patch バージョンを自動 bump し、VS Code Marketplace に publish する。
4+
# bot のコミットは GITHUB_TOKEN によるものなので再度ワークフローを起こさない(無限ループ防止)。
55

66
on:
77
push:
88
branches:
99
- main
10+
paths-ignore:
11+
- 'README.md'
12+
- 'CHANGELOG.md'
13+
- 'LICENSE'
14+
- 'SECURITY.md'
15+
- 'vsc-extension-quickstart.md'
16+
- '.github/**'
17+
18+
permissions:
19+
contents: write
20+
21+
concurrency:
22+
group: publish-extension
23+
cancel-in-progress: false
1024

1125
jobs:
1226
publish:
1327
runs-on: ubuntu-latest
1428
steps:
1529
- uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 2
18-
19-
- name: Check if version changed
20-
id: version
21-
run: |
22-
CURRENT=$(node -p "require('./package.json').version")
23-
git show HEAD~1:package.json > /tmp/prev-package.json 2>/dev/null || echo '{}' > /tmp/prev-package.json
24-
PREVIOUS=$(node -p "require('/tmp/prev-package.json').version || 'none'")
25-
echo "current=$CURRENT, previous=$PREVIOUS"
26-
if [ "$CURRENT" != "$PREVIOUS" ]; then
27-
echo "changed=true" >> "$GITHUB_OUTPUT"
28-
else
29-
echo "changed=false" >> "$GITHUB_OUTPUT"
30-
echo "Version unchanged ($CURRENT) - skipping publish."
31-
fi
3230

3331
- uses: actions/setup-node@v4
34-
if: steps.version.outputs.changed == 'true'
3532
with:
3633
node-version: 20
34+
cache: npm
3735

3836
- run: npm ci
39-
if: steps.version.outputs.changed == 'true'
4037

41-
- run: npx vsce publish -p ${{ secrets.VSCE_PAT }}
42-
if: steps.version.outputs.changed == 'true'
38+
- name: Bump patch version
39+
id: bump
40+
run: |
41+
git config user.name "github-actions[bot]"
42+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
43+
NEW_VERSION=$(npm version patch --no-git-tag-version)
44+
echo "version=${NEW_VERSION#v}" >> "$GITHUB_OUTPUT"
45+
git add package.json package-lock.json
46+
git commit -m "chore: release ${NEW_VERSION}"
47+
git push
48+
49+
- name: Publish to VS Code Marketplace
50+
env:
51+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
52+
run: npx vsce publish
53+
54+
- name: Tag release
55+
run: |
56+
git tag "v${{ steps.bump.outputs.version }}"
57+
git push origin "v${{ steps.bump.outputs.version }}"

0 commit comments

Comments
 (0)