Elffuss BraidHub

kikocis/continue public

dfc814e4318e · 4.8 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 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: false
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 check-version:
92 runs-on: ubuntu-latest
93 steps:
94 - name: Checkout
95 uses: actions/checkout@v5
96 with:
97 fetch-depth: 0 # This ensures all tags are fetched
98
99 - name: Checkout tag
100 run: git checkout ${GITHUB_REF#refs/tags/}
101
102 - name: Make sure version isn't odd
103 run: |
104 cd extensions/vscode
105 node scripts/versionCheck.js
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