| 1 | name: Publish Pre-release Extension |
| 2 | |
| 3 | on: |
| 4 | release: |
| 5 | types: [prereleased] |
| 6 | |
| 7 | workflow_dispatch: |
| 8 | inputs: |
| 9 | publish_build: |
| 10 | description: "Whether or not to publish the built extension to the VS Code marketplace" |
| 11 | required: true |
| 12 | default: "false" |
| 13 | |
| 14 | jobs: |
| 15 | check_release_name: |
| 16 | runs-on: ubuntu-latest |
| 17 | outputs: |
| 18 | should_run: ${{ steps.check.outputs.should_run }} |
| 19 | steps: |
| 20 | - id: check |
| 21 | working-directory: . |
| 22 | run: | |
| 23 | if [[ "${{ github.event.release.tag_name }}" == v1.3.*-vscode ]]; then |
| 24 | echo "should_run=true" >> $GITHUB_OUTPUT |
| 25 | else |
| 26 | echo "should_run=false" >> $GITHUB_OUTPUT |
| 27 | fi |
| 28 | |
| 29 | build: |
| 30 | needs: check_release_name |
| 31 | if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' |
| 32 | runs-on: ${{ matrix.os }} |
| 33 | strategy: |
| 34 | matrix: |
| 35 | include: |
| 36 | - os: windows-latest |
| 37 | platform: win32 |
| 38 | arch: x64 |
| 39 | npm_config_arch: x64 |
| 40 | - os: windows-latest |
| 41 | platform: win32 |
| 42 | arch: arm64 |
| 43 | npm_config_arch: arm |
| 44 | - os: ubuntu-latest |
| 45 | platform: linux |
| 46 | arch: x64 |
| 47 | npm_config_arch: x64 |
| 48 | - os: ubuntu-latest |
| 49 | platform: linux |
| 50 | arch: arm64 |
| 51 | npm_config_arch: arm64 |
| 52 | - os: ubuntu-latest |
| 53 | platform: linux |
| 54 | arch: armhf |
| 55 | npm_config_arch: arm |
| 56 | - os: ubuntu-latest |
| 57 | platform: alpine |
| 58 | arch: x64 |
| 59 | npm_config_arch: x64 |
| 60 | - os: macos-13 |
| 61 | platform: darwin |
| 62 | arch: x64 |
| 63 | npm_config_arch: x64 |
| 64 | - os: macos-13 |
| 65 | platform: darwin |
| 66 | arch: arm64 |
| 67 | npm_config_arch: arm64 |
| 68 | steps: |
| 69 | - uses: actions/checkout@v5 |
| 70 | with: |
| 71 | fetch-depth: 0 |
| 72 | |
| 73 | - uses: actions/setup-node@v5 |
| 74 | with: |
| 75 | node-version-file: ".nvmrc" |
| 76 | |
| 77 | - uses: ./.github/actions/build-vscode-extension |
| 78 | with: |
| 79 | platform: ${{ matrix.platform }} |
| 80 | arch: ${{ matrix.arch }} |
| 81 | npm_config_arch: ${{ matrix.npm_config_arch }} |
| 82 | pre-release: true |
| 83 | github-token: ${{ secrets.GITHUB_TOKEN }} |
| 84 | |
| 85 | - name: Upload .vsix artifact |
| 86 | uses: actions/upload-artifact@v4 |
| 87 | with: |
| 88 | name: ${{ matrix.platform }}-${{ matrix.arch }}-vsix |
| 89 | path: "extensions/vscode/*.vsix" |
| 90 | |
| 91 | release: |
| 92 | permissions: |
| 93 | contents: write |
| 94 | runs-on: ubuntu-latest |
| 95 | needs: |
| 96 | - build |
| 97 | steps: |
| 98 | - name: Checkout |
| 99 | uses: actions/checkout@v5 |
| 100 | |
| 101 | - name: Set up Git |
| 102 | run: | |
| 103 | git config --local user.email "action@github.com" |
| 104 | git config --local user.name "GitHub Action" |
| 105 | |
| 106 | # Download the .vsix artifacts |
| 107 | - uses: actions/download-artifact@v5 |
| 108 | with: |
| 109 | pattern: "*-vsix" |
| 110 | path: vsix-artifacts |
| 111 | merge-multiple: true |
| 112 | |
| 113 | - name: Release |
| 114 | uses: softprops/action-gh-release@v2 |
| 115 | with: |
| 116 | tag_name: ${{ github.ref_name }} |
| 117 | files: | |
| 118 | vsix-artifacts/*.vsix |
| 119 | token: ${{ secrets.CI_GITHUB_TOKEN }} |
| 120 | repository: continuedev/continue |
| 121 | prerelease: true |
| 122 | |
| 123 | publish: |
| 124 | runs-on: ubuntu-latest |
| 125 | needs: |
| 126 | - build |
| 127 | if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true' |
| 128 | permissions: |
| 129 | contents: write |
| 130 | pull-requests: write |
| 131 | steps: |
| 132 | # 0. Setup git |
| 133 | - name: Checkout |
| 134 | uses: actions/checkout@v5 |
| 135 | |
| 136 | - name: Set up Git |
| 137 | run: | |
| 138 | git config --local user.email "action@github.com" |
| 139 | git config --local user.name "GitHub Action" |
| 140 | |
| 141 | - name: Pull latest changes from release |
| 142 | run: git fetch origin ${{ github.ref }} && git checkout ${{ github.ref }} |
| 143 | |
| 144 | # 1. Download the artifacts |
| 145 | - uses: actions/download-artifact@v5 |
| 146 | with: |
| 147 | pattern: "*-vsix" |
| 148 | path: vsix-artifacts |
| 149 | merge-multiple: true |
| 150 | |
| 151 | # 2. Publish the extension to VS Code Marketplace |
| 152 | - name: Publish to VS Code Marketplace |
| 153 | run: | |
| 154 | cd extensions/vscode |
| 155 | npx @vscode/vsce publish --pre-release --packagePath ../../vsix-artifacts/*.vsix |
| 156 | env: |
| 157 | VSCE_PAT: ${{ secrets.VSCE_TOKEN }} |
| 158 | |
| 159 | # 3. Publish the extension to Open VSX Registry |
| 160 | - name: Publish (Open VSX Registry) |
| 161 | continue-on-error: true |
| 162 | run: | |
| 163 | cd extensions/vscode |
| 164 | npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix |
| 165 | |
| 166 | # 4. Create PR with version bump |
| 167 | - name: Setup Node.js |
| 168 | uses: actions/setup-node@v5 |
| 169 | with: |
| 170 | node-version-file: ".nvmrc" |
| 171 | |
| 172 | - name: Create PR branch |
| 173 | run: | |
| 174 | BRANCH_NAME="chore/bump-vscode-version-$(date +%Y%m%d-%H%M%S)" |
| 175 | git checkout -b $BRANCH_NAME |
| 176 | echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV |
| 177 | |
| 178 | - name: Bump version in package.json |
| 179 | run: | |
| 180 | cd extensions/vscode |
| 181 | npm version patch --no-git-tag-version |
| 182 | VERSION=$(node -p "require('./package.json').version") |
| 183 | echo "NEW_VERSION=$VERSION" >> $GITHUB_ENV |
| 184 | |
| 185 | - name: Create Pull Request |
| 186 | uses: peter-evans/create-pull-request@v7 |
| 187 | with: |
| 188 | token: ${{ secrets.CI_GITHUB_TOKEN }} |
| 189 | commit-message: "chore: bump vscode extension version to ${{ env.NEW_VERSION }}" |
| 190 | title: "chore: bump vscode extension version to ${{ env.NEW_VERSION }}" |
| 191 | body: | |
| 192 | Automated PR to bump the VS Code extension version after successful pre-release publication. |
| 193 | |
| 194 | - Bumped version in extensions/vscode/package.json to ${{ env.NEW_VERSION }} |
| 195 | branch: ${{ env.BRANCH_NAME }} |
| 196 | base: main |
| 197 | delete-branch: true |
| 198 | |
| 199 | # 5. Update version in package.json |
| 200 | # - name: Update version in package.json |
| 201 | # run: | |
| 202 | # cd extensions/vscode |
| 203 | # npm version patch |
| 204 | # - name: Commit changes |
| 205 | # run: | |
| 206 | # git config --local user.email "action@github.com" |
| 207 | # git config --local user.name "GitHub Action" |
| 208 | # git commit -am "馃挌 Update package.json version [skip ci]" |
| 209 | |
| 210 | # - name: Push changes |
| 211 | # uses: ad-m/github-push-action@master |
| 212 | # with: |
| 213 | # github_token: ${{ secrets.GITHUB_TOKEN }} |
| 214 | # branch: ${{ github.ref }} |