Compare commits
6 Commits
0.0.1
...
77e4df420e
| Author | SHA1 | Date | |
|---|---|---|---|
|
77e4df420e
|
|||
|
f6467a82c2
|
|||
|
d895f58963
|
|||
| d9e44b78ce | |||
|
4b38333d23
|
|||
|
bea2ea2a0f
|
84
.gitea/workflows/release.yaml
Normal file
84
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,84 @@
|
||||
name: Release VSCode Extension
|
||||
run-name: ${{ gitea.actor }} is releasing a new version 🚀
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '[0-9]+.[0-9]+.[0-9]+'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Step 1: Checkout the repository code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Step 2: Set up Node.js environment
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
# Step 3: Install jq for JSON parsing
|
||||
- name: Install jq
|
||||
run: sudo apt-get install -y jq
|
||||
|
||||
# Step 4: Install project dependencies inside prompter directory
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
# Step 5: Install vsce
|
||||
- name: Install vsce
|
||||
run: npm install @vscode/vsce
|
||||
|
||||
# Step 6: Install additional dev dependencies for building inside prompter directory
|
||||
- name: Install build tools
|
||||
run: npm install --save-dev webpack webpack-cli ts-loader codegen
|
||||
|
||||
# Step 7: Build the extension inside prompter directory
|
||||
- name: Build the extension
|
||||
run: npm run webpack:prod
|
||||
|
||||
# Step 8: Package the extension into a VSIX file inside prompter directory
|
||||
- name: Package the extension
|
||||
run: npx vsce package
|
||||
|
||||
# Step 9: Extract the tag name from gitea.ref
|
||||
- name: Extract tag name
|
||||
run: |
|
||||
TAG_NAME=$(echo "${{ gitea.ref }}" | sed 's/refs\/tags\///')
|
||||
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
|
||||
|
||||
# Step 10: Determine the VSIX file name from package.json inside prompter directory
|
||||
- name: Get VSIX file name
|
||||
run: |
|
||||
NAME=$(jq -r .name package.json)
|
||||
VERSION=$(jq -r .version package.json)
|
||||
VSIX_FILE="${NAME}-${VERSION}.vsix"
|
||||
echo "VSIX_FILE=$VSIX_FILE" >> $GITHUB_ENV
|
||||
|
||||
# Step 11: Create a new release in Gitea
|
||||
- name: Create release
|
||||
run: |
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ gitea.token }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"Release $TAG_NAME\", \"body\": \"Automated release for version $TAG_NAME\"}" \
|
||||
https://git.bhakat.dev/api/v1/repos/abhishekbhakat/Prompter/releases
|
||||
|
||||
# Step 12: Retrieve the release ID
|
||||
- name: Get release ID
|
||||
run: |
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${{ gitea.token }}" \
|
||||
https://git.bhakat.dev/api/v1/repos/abhishekbhakat/Prompter/releases/tags/$TAG_NAME | jq .id)
|
||||
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
|
||||
|
||||
# Step 13: Upload the VSIX file as a release asset (from prompter directory)
|
||||
- name: Upload VSIX to release
|
||||
run: |
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ gitea.token }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"prompter/$VSIX_FILE" \
|
||||
https://git.bhakat.dev/api/v1/repos/abhishekbhakat/Prompter/releases/$RELEASE_ID/assets?name=$VSIX_FILE
|
||||
@@ -2,9 +2,9 @@
|
||||
"name": "prompter",
|
||||
"displayName": "Prompter",
|
||||
"description": "Easy prompt generation and apply edits using prompter.",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"publisher": "abhishekbhakat",
|
||||
"repository": "https://github.com/abhishekbhakat/prompter",
|
||||
"repository": "https://git.bhakat.dev/abhishekbhakat/Prompter",
|
||||
"engines": {
|
||||
"vscode": "^1.98.0"
|
||||
},
|
||||
@@ -104,7 +104,6 @@
|
||||
"webpack-cli": "^6.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vscode/vsce": "^3.2.2",
|
||||
"ignore": "^7.0.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,21 @@ export class PrompterTreeProvider implements vscode.TreeDataProvider<FileTreeIte
|
||||
try {
|
||||
const files = await vscode.workspace.fs.readDirectory(vscode.Uri.file(dirPath));
|
||||
|
||||
return files.map(([name, type]) => {
|
||||
// Sort by type first (directories first), then alphabetically by name
|
||||
const sortedFiles = [...files].sort((a, b) => {
|
||||
const [nameA, typeA] = a;
|
||||
const [nameB, typeB] = b;
|
||||
|
||||
// If types are different, directories (type 2) come before files (type 1)
|
||||
if (typeA !== typeB) {
|
||||
return typeB - typeA; // Descending order by type puts directories first
|
||||
}
|
||||
|
||||
// If types are the same, sort alphabetically by name
|
||||
return nameA.localeCompare(nameB, undefined, { sensitivity: 'base' });
|
||||
});
|
||||
|
||||
return sortedFiles.map(([name, type]) => {
|
||||
const filePath = path.join(dirPath, name);
|
||||
const uri = vscode.Uri.file(filePath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user