Kilo Icon on editor actions #2032
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Extension | |
| on: | |
| pull_request: | |
| types: [closed] | |
| workflow_dispatch: | |
| env: | |
| GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }} | |
| NODE_VERSION: 20.19.2 | |
| PNPM_VERSION: 10.8.1 | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
| jobs: | |
| create-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required for pushing tags and creating releases | |
| if: > | |
| ( github.event_name == 'pull_request' && | |
| github.event.pull_request.base.ref == 'main' && | |
| contains(github.event.pull_request.title, 'Changeset version bump') ) || | |
| github.event_name == 'workflow_dispatch' | |
| outputs: | |
| version: ${{ steps.get-version.outputs.version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ env.GIT_REF }} | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Create .env file | |
| run: echo "KILOCODE_POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" >> .env | |
| - name: Get version | |
| id: get-version | |
| run: | | |
| current_package_version=$(node -p "require('./src/package.json').version") | |
| echo "version=${current_package_version}" >> $GITHUB_OUTPUT | |
| echo "Version: ${current_package_version}" | |
| - name: Package Extension | |
| run: | | |
| current_package_version=$(node -p "require('./src/package.json').version") | |
| pnpm vsix:production | |
| # Save VSIX contents to a temporary file to avoid broken pipe issues. | |
| unzip -l bin/kilo-code-${current_package_version}.vsix > /tmp/kilo-code-vsix-contents.txt | |
| # Check for required files. | |
| grep -q "extension/package.json" /tmp/kilo-code-vsix-contents.txt || exit 1 | |
| grep -q "extension/package.nls.json" /tmp/kilo-code-vsix-contents.txt || exit 1 | |
| grep -q "extension/dist/extension.js" /tmp/kilo-code-vsix-contents.txt || exit 1 | |
| grep -q "extension/webview-ui/audio/celebration.wav" /tmp/kilo-code-vsix-contents.txt || exit 1 | |
| grep -q "extension/webview-ui/build/assets/index.js" /tmp/kilo-code-vsix-contents.txt || exit 1 | |
| grep -q "extension/assets/codicons/codicon.ttf" /tmp/kilo-code-vsix-contents.txt || exit 1 | |
| grep -q "extension/assets/vscode-material-icons/icons/3d.svg" /tmp/kilo-code-vsix-contents.txt || exit 1 | |
| grep -q ".env" /tmp/kilo-code-vsix-contents.txt || exit 1 | |
| # Clean up temporary file. | |
| rm /tmp/kilo-code-vsix-contents.txt | |
| - name: Create and Push Git Tag | |
| run: | | |
| current_package_version=$(node -p "require('./src/package.json').version") | |
| # Check if tag already exists remotely | |
| if git ls-remote --tags origin | grep -q "refs/tags/v${current_package_version}$"; then | |
| echo "Tag v${current_package_version} already exists remotely, skipping tag creation" | |
| else | |
| git tag -a "v${current_package_version}" -m "Release v${current_package_version}" | |
| git push origin "v${current_package_version}" --no-verify | |
| echo "Successfully created and pushed git tag v${current_package_version}" | |
| fi | |
| - name: Create GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| current_package_version=$(node -p "require('./src/package.json').version") | |
| if gh release view "v${current_package_version}" >/dev/null 2>&1; then | |
| echo "Release v${current_package_version} already exists, skipping release creation" | |
| exit 0 | |
| fi | |
| echo "Extracting changelog for version ${current_package_version}" | |
| # Match version headers: ## [vX.X.X], ## [X.X.X], ## X.X.X (brackets and v are optional) | |
| changelog_content=$(sed -E -n "/^## \\[?v?${current_package_version}\\]?/,/^## /p" CHANGELOG.md | sed '$d') | |
| if [ -z "$changelog_content" ]; then | |
| echo "Error: No changelog section found for version ${current_package_version}" | |
| echo "Please add a changelog entry in CHANGELOG.md for version ${current_package_version}" | |
| exit 1 | |
| fi | |
| echo "Found changelog section for version ${current_package_version}" | |
| # Create release with changelog content | |
| gh release create "v${current_package_version}" \ | |
| --title "Release v${current_package_version}" \ | |
| --notes "$changelog_content" \ | |
| --target ${{ env.GIT_REF }} \ | |
| bin/kilo-code-${current_package_version}.vsix | |
| echo "Successfully created GitHub Release v${current_package_version}" | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: kilo-code-vsix | |
| path: bin/kilo-code-${{ steps.get-version.outputs.version }}.vsix | |
| publish-vscode: | |
| needs: create-release | |
| runs-on: ubuntu-latest | |
| if: > | |
| ( github.event_name == 'pull_request' && | |
| github.event.pull_request.base.ref == 'main' && | |
| contains(github.event.pull_request.title, 'Changeset version bump') ) || | |
| github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ env.GIT_REF }} | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Download VSIX artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: kilo-code-vsix | |
| path: bin/ | |
| - name: Publish to VS Code Marketplace | |
| continue-on-error: true | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_TOKEN }} | |
| OVSX_PAT: ${{ secrets.OVSX_TOKEN }} | |
| run: | | |
| current_package_version="${{ needs.create-release.outputs.version }}" | |
| cd src | |
| npx vsce publish --packagePath ../bin/kilo-code-${current_package_version}.vsix | |
| npx ovsx publish ../bin/kilo-code-${current_package_version}.vsix | |
| echo "Successfully published version $current_package_version to VS Code Marketplace" | |
| publish-jetbrains: | |
| needs: create-release | |
| runs-on: ubuntu-latest | |
| if: > | |
| ( github.event_name == 'pull_request' && | |
| github.event.pull_request.base.ref == 'main' && | |
| contains(github.event.pull_request.title, 'Changeset version bump') ) || | |
| github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| lfs: true | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "pnpm" | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: "jetbrains" | |
| java-version: "21" | |
| check-latest: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| with: | |
| cache-read-only: false | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libx11-dev \ | |
| libxkbfile-dev \ | |
| pkg-config \ | |
| build-essential \ | |
| python3 | |
| - name: Turbo cache setup | |
| uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: ${{ runner.os }}-turbo-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-turbo- | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Create .env file | |
| run: echo "KILOCODE_POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" >> .env | |
| - name: Build JetBrains Plugin | |
| run: pnpm run jetbrains:bundle | |
| shell: bash | |
| - name: Get bundle name | |
| id: get_bundle_name | |
| run: echo "BUNDLE_NAME=$(node jetbrains/plugin/scripts/get_bundle_name.js)" >> $GITHUB_ENV | |
| - name: Attach to GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| current_package_version="${{ needs.create-release.outputs.version }}" | |
| gh release upload "v${current_package_version}" \ | |
| "jetbrains/plugin/build/distributions/${{ env.BUNDLE_NAME }}#JetBrains Plugin" \ | |
| --clobber | |
| echo "Successfully attached JetBrains plugin to GitHub Release v${current_package_version}" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BUNDLE_NAME }} | |
| path: jetbrains/plugin/build/distributions/${{ env.BUNDLE_NAME }} | |
| - name: Publish to JetBrains Marketplace | |
| continue-on-error: true | |
| run: | | |
| curl \ | |
| -X POST \ | |
| -H "Authorization: Bearer ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }}" \ | |
| -F "file=@jetbrains/plugin/build/distributions/${{ env.BUNDLE_NAME }}" \ | |
| -F "pluginId=28350" \ | |
| -F "channel=stable" \ | |
| -F "isHidden=false" \ | |
| https://plugins.jetbrains.com/plugin/uploadPlugin | |
| echo "Successfully published to JetBrains Marketplace" |