Elffuss BraidHub

kikocis/continue public

main · 4.9 KiBRawPermalink
1name: Publish Extension
2
3on:
4 release:
5 types: [released]
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
14jobs:
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.2.*-vscode ]]; then
24 echo "should_run=true" >> $GITHUB_OUTPUT
25 else
26 echo "should_run=false" >> $GITHUB_OUTPUT
27 fi
28
29 check-version:
30 runs-on: ubuntu-latest
31 steps:
32 - name: Checkout
33 uses: actions/checkout@v5
34 with:
35 fetch-depth: 0 # This ensures all tags are fetched
36
37 - name: Checkout tag
38 run: git checkout ${GITHUB_REF#refs/tags/}
39
40 - name: Make sure version isn't odd
41 run: |
42 cd extensions/vscode
43 node scripts/versionCheck.js
44
45 build:
46 needs: [check_release_name, check-version]
47 if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch'
48 runs-on: ${{ matrix.os }}
49 strategy:
50 matrix:
51 include:
52 - os: windows-latest
53 platform: win32
54 arch: x64
55 npm_config_arch: x64
56 - os: windows-latest
57 platform: win32
58 arch: arm64
59 npm_config_arch: arm
60 - os: ubuntu-latest
61 platform: linux
62 arch: x64
63 npm_config_arch: x64
64 - os: ubuntu-latest
65 platform: linux
66 arch: arm64
67 npm_config_arch: arm64
68 - os: ubuntu-latest
69 platform: linux
70 arch: armhf
71 npm_config_arch: arm
72 - os: ubuntu-latest
73 platform: alpine
74 arch: x64
75 npm_config_arch: x64
76 - os: macos-13
77 platform: darwin
78 arch: x64
79 npm_config_arch: x64
80 - os: macos-13
81 platform: darwin
82 arch: arm64
83 npm_config_arch: arm64
84 steps:
85 - uses: actions/checkout@v5
86 with:
87 fetch-depth: 0
88
89 - uses: actions/setup-node@v5
90 with:
91 node-version-file: ".nvmrc"
92
93 - uses: ./.github/actions/build-vscode-extension
94 with:
95 platform: ${{ matrix.platform }}
96 arch: ${{ matrix.arch }}
97 npm_config_arch: ${{ matrix.npm_config_arch }}
98 pre-release: false
99 github-token: ${{ secrets.GITHUB_TOKEN }}
100
101 - name: Upload .vsix artifact
102 uses: actions/upload-artifact@v4
103 with:
104 name: ${{ matrix.platform }}-${{ matrix.arch }}-vsix
105 path: "extensions/vscode/*.vsix"
106
107 release:
108 permissions:
109 contents: write
110 runs-on: ubuntu-latest
111 needs:
112 - build
113 steps:
114 - name: Checkout
115 uses: actions/checkout@v5
116
117 - name: Set up Git
118 run: |
119 git config --local user.email "action@github.com"
120 git config --local user.name "GitHub Action"
121
122 # Download the .vsix artifacts
123 - uses: actions/download-artifact@v5
124 with:
125 pattern: "*-vsix"
126 path: vsix-artifacts
127 merge-multiple: true
128
129 - name: Release
130 uses: softprops/action-gh-release@v2
131 with:
132 tag_name: ${{ github.ref_name }}
133 files: |
134 vsix-artifacts/*.vsix
135 token: ${{ secrets.CI_GITHUB_TOKEN }}
136 repository: continuedev/continue
137
138 publish:
139 runs-on: ubuntu-latest
140 needs:
141 - build
142 if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true'
143 permissions:
144 contents: write
145 steps:
146 # 0. Setup git
147 - name: Checkout
148 uses: actions/checkout@v5
149
150 - name: Set up Git
151 run: |
152 git config --local user.email "action@github.com"
153 git config --local user.name "GitHub Action"
154
155 - name: Pull latest changes from release
156 run: git fetch origin ${{ github.ref }} && git checkout ${{ github.ref }}
157
158 # 1. Download the artifacts
159 - uses: actions/download-artifact@v5
160 with:
161 pattern: "*-vsix"
162 path: vsix-artifacts
163 merge-multiple: true
164
165 # 2. Publish the extension to VS Code Marketplace
166 - name: Publish to VS Code Marketplace
167 run: |
168 cd extensions/vscode
169 npx @vscode/vsce publish --packagePath ../../vsix-artifacts/*.vsix
170 env:
171 VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
172
173 # 3. Publish the extension to Open VSX Registry
174 - name: Publish (Open VSX Registry)
175 continue-on-error: true
176 run: |
177 cd extensions/vscode
178 npx ovsx publish -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix