Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch: # 手动触发

jobs:
build:
Expand All @@ -24,3 +25,49 @@ jobs:

- name: compile
run: npm run compile

release:
if: ${{ github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm install && cd src/vue && npm install && cd ../..

Comment on lines +43 to +45
Copy link

Copilot AI May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider splitting dependency installations into separate steps or using explicit working directory settings to improve clarity and error handling in the workflow.

Suggested change
- name: Install dependencies
run: npm install && cd src/vue && npm install && cd ../..
- name: Install root dependencies
run: npm install
- name: Install Vue dependencies
run: npm install
working-directory: src/vue

Copilot uses AI. Check for mistakes.
- name: Compile the extension
run: npm run compile

- name: Package the extension
run: |
npm install -g @vscode/vsce
vsce package
env:
NODE_ENV: production

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ github.run_number }}
release_name: "Release v${{ github.run_number }}"
Comment on lines +56 to +61
Copy link

Copilot AI May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using github.run_number for generating release tags might lead to non-semantic versioning; consider adopting a versioning scheme that better conveys release meaning.

Suggested change
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: v${{ github.run_number }}
release_name: "Release v${{ github.run_number }}"
- name: Update version
id: update_version
run: |
VERSION=$(cat VERSION)
echo "Current version: $VERSION"
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
if [ "${{ github.event.inputs.release_type }}" == "major" ]; then
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
elif [ "${{ github.event.inputs.release_type }}" == "minor" ]; then
MINOR=$((MINOR + 1))
PATCH=0
else
PATCH=$((PATCH + 1))
fi
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
echo "New version: $NEW_VERSION"
echo "$NEW_VERSION" > VERSION
echo "::set-output name=new_version::$NEW_VERSION"
git config user.name "github-actions"
git config user.email "[email protected]"
git add VERSION
git commit -m "Bump version to $NEW_VERSION"
git push
uses: actions/create-release@v1
with:
tag_name: v${{ steps.update_version.outputs.new_version }}
release_name: "Release v${{ steps.update_version.outputs.new_version }}"

Copilot uses AI. Check for mistakes.
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload VSIX to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./vscode-rt-smart-*.vsix
asset_name: vscode-rt-smart.vsix
asset_content_type: application/octet-stream