github actions
This commit is contained in:
parent
0ffd2648d6
commit
f9ea4f84da
4 changed files with 49 additions and 37 deletions
44
.github/workflows/main.yaml
vendored
Normal file
44
.github/workflows/main.yaml
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
name: Publish Extension
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Build and Publish
|
||||
run: |
|
||||
cd extension
|
||||
npm run full-package
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
git commit -am "Update package.json version [skip ci]"
|
||||
|
||||
- name: Push changes
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload .vsix artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: vsix-artifact
|
||||
path: extension/build/*
|
||||
|
|
@ -136,6 +136,8 @@ class ContinueSDK(AbstractContinueSDK):
|
|||
|
||||
async def add_file(self, filename: str, content: Union[str, None]):
|
||||
filepath = await self._ensure_absolute_path(filename)
|
||||
dir_name = os.path.dirname(filepath)
|
||||
os.makedirs(dir_name, exist_ok=True)
|
||||
return await self.run_step(FileSystemEditStep(edit=AddFile(filepath=filepath, content=content)))
|
||||
|
||||
async def delete_file(self, filename: str):
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class SimpleChatStep(Step):
|
|||
|
||||
class AddFileStep(Step):
|
||||
name: str = "Add File"
|
||||
description = "Add a file to the workspace."
|
||||
description = "Add a file to the workspace. Should always view the directory tree before this."
|
||||
filename: str
|
||||
file_contents: str
|
||||
|
||||
|
|
@ -70,11 +70,7 @@ class AddFileStep(Step):
|
|||
return f"Added a file named `{self.filename}` to the workspace."
|
||||
|
||||
async def run(self, sdk: ContinueSDK):
|
||||
try:
|
||||
await sdk.add_file(self.filename, self.file_contents)
|
||||
except FileNotFoundError:
|
||||
self.description = f"File {self.filename} does not exist."
|
||||
return
|
||||
await sdk.add_file(self.filename, self.file_contents)
|
||||
|
||||
await sdk.ide.setFileOpen(os.path.join(sdk.ide.workspace_directory, self.filename))
|
||||
|
||||
|
|
@ -132,7 +128,7 @@ class ViewDirectoryTreeStep(Step):
|
|||
return f"Viewed the directory tree."
|
||||
|
||||
async def run(self, sdk: ContinueSDK):
|
||||
self.description = f"```\n{display_tree(sdk.ide.workspace_directory, True)}\n```"
|
||||
self.description = f"```\n{display_tree(sdk.ide.workspace_directory, True, max_depth=2)}\n```"
|
||||
|
||||
|
||||
class EditFileStep(Step):
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
# GitHub Actions Workflow to compile the extension and `npm run package`
|
||||
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 19.0.0
|
||||
- run: npm ci
|
||||
- run: npm run clientgen
|
||||
- run: npm run compile
|
||||
- run: cd react-app && npm install && npm run build
|
||||
- run: npm run package
|
||||
- name: Save build as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: packaged-extension
|
||||
path: build/*.vsix
|
||||
Loading…
Add table
Reference in a new issue