|
8 | 8 | workflow_dispatch: |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - goreleaser: |
12 | | - environment: sign |
13 | | - runs-on: |
14 | | - group: databricks-deco-testing-runner-group |
15 | | - labels: ubuntu-latest-deco |
16 | | - |
17 | | - outputs: |
18 | | - artifacts: ${{ steps.releaser.outputs.artifacts }} |
19 | | - |
20 | | - steps: |
21 | | - - name: Checkout repository and submodules |
22 | | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
23 | | - with: |
24 | | - fetch-depth: 0 |
25 | | - fetch-tags: true |
26 | | - |
27 | | - - name: Setup Go |
28 | | - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 |
29 | | - with: |
30 | | - go-version-file: go.mod |
31 | | - |
32 | | - # The default cache key for this action considers only the `go.sum` file. |
33 | | - # We include .goreleaser.yaml here to differentiate from the cache used by the push action |
34 | | - # that runs unit tests. This job produces and uses a different cache. |
35 | | - cache-dependency-path: | |
36 | | - go.sum |
37 | | - .goreleaser.yaml |
38 | | -
|
39 | | - # Log into the GitHub Container Registry. The goreleaser action will create |
40 | | - # the docker images and push them to the GitHub Container Registry. |
41 | | - - uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 |
42 | | - with: |
43 | | - registry: "ghcr.io" |
44 | | - username: "${{ github.actor }}" |
45 | | - password: "${{ secrets.GITHUB_TOKEN }}" |
46 | | - |
47 | | - # QEMU is required to build cross platform docker images using buildx. |
48 | | - # It allows virtualization of the CPU architecture at the application level. |
49 | | - - name: Set up QEMU dependency |
50 | | - uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 |
51 | | - |
52 | | - - name: Run GoReleaser |
53 | | - id: releaser |
54 | | - uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 |
55 | | - with: |
56 | | - version: ~> v2 |
57 | | - args: release |
58 | | - env: |
59 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
60 | | - |
61 | 11 | sign-windows: |
62 | 12 | environment: sign |
63 | 13 | runs-on: windows-latest |
64 | | - needs: goreleaser |
65 | 14 |
|
66 | 15 | steps: |
67 | 16 | - name: Checkout repository |
68 | 17 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
69 | 18 |
|
70 | 19 | - name: Download Windows artifacts |
71 | 20 | run: | |
72 | | - gh release download ${{ github.ref_name }} --pattern '*windows*.zip' --dir artifacts |
| 21 | + gh release download v0.276.0 --pattern '*windows*.zip' --dir artifacts |
73 | 22 | env: |
74 | 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
75 | 24 |
|
@@ -117,214 +66,3 @@ jobs: |
117 | 66 | $signedArchivePath = "signed-artifacts\$archiveName-signed.zip" |
118 | 67 | Compress-Archive -Path "$($_.FullName)\*" -DestinationPath $signedArchivePath |
119 | 68 | } |
120 | | -
|
121 | | - - name: Upload signed Windows artifacts to release |
122 | | - shell: pwsh |
123 | | - run: | |
124 | | - Get-ChildItem signed-artifacts -Filter *.zip | ForEach-Object { |
125 | | - Write-Host "Uploading $($_.Name)" |
126 | | - gh release upload ${{ github.ref_name }} $_.FullName |
127 | | - } |
128 | | - env: |
129 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
130 | | - |
131 | | - create-setup-cli-release-pr: |
132 | | - runs-on: |
133 | | - group: databricks-deco-testing-runner-group |
134 | | - labels: ubuntu-latest-deco |
135 | | - |
136 | | - needs: goreleaser |
137 | | - |
138 | | - steps: |
139 | | - - name: Set VERSION variable from tag |
140 | | - run: | |
141 | | - VERSION=${{ github.ref_name }} |
142 | | - echo "VERSION=${VERSION:1}" >> $GITHUB_ENV |
143 | | -
|
144 | | - - name: Update setup-cli |
145 | | - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
146 | | - with: |
147 | | - github-token: ${{ secrets.DECO_GITHUB_TOKEN }} |
148 | | - script: | |
149 | | - await github.rest.actions.createWorkflowDispatch({ |
150 | | - owner: 'databricks', |
151 | | - repo: 'setup-cli', |
152 | | - workflow_id: 'release-pr.yml', |
153 | | - ref: 'main', |
154 | | - inputs: { |
155 | | - version: "${{ env.VERSION }}", |
156 | | - } |
157 | | - }); |
158 | | -
|
159 | | - create-homebrew-tap-release-pr: |
160 | | - runs-on: |
161 | | - group: databricks-deco-testing-runner-group |
162 | | - labels: ubuntu-latest-deco |
163 | | - |
164 | | - needs: goreleaser |
165 | | - |
166 | | - steps: |
167 | | - - name: Set VERSION variable from tag |
168 | | - run: | |
169 | | - VERSION=${{ github.ref_name }} |
170 | | - echo "VERSION=${VERSION:1}" >> $GITHUB_ENV |
171 | | -
|
172 | | - - name: Update homebrew-tap |
173 | | - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
174 | | - with: |
175 | | - github-token: ${{ secrets.DECO_GITHUB_TOKEN }} |
176 | | - script: | |
177 | | - let artifacts = ${{ needs.goreleaser.outputs.artifacts }} |
178 | | - artifacts = artifacts.filter(a => a.type == "Archive") |
179 | | - artifacts = new Map( |
180 | | - artifacts.map(a => [ |
181 | | - a.goos + "_" + a.goarch + "_" + a.extra.Format, |
182 | | - a.extra.Checksum.replace("sha256:", "") |
183 | | - ]) |
184 | | - ) |
185 | | -
|
186 | | - await github.rest.actions.createWorkflowDispatch({ |
187 | | - owner: 'databricks', |
188 | | - repo: 'homebrew-tap', |
189 | | - workflow_id: 'release-pr.yml', |
190 | | - ref: 'main', |
191 | | - inputs: { |
192 | | - version: "${{ env.VERSION }}", |
193 | | - darwin_amd64_sha: artifacts.get('darwin_amd64_zip'), |
194 | | - darwin_arm64_sha: artifacts.get('darwin_arm64_zip'), |
195 | | - linux_amd64_sha: artifacts.get('linux_amd64_zip'), |
196 | | - linux_arm64_sha: artifacts.get('linux_arm64_zip') |
197 | | - } |
198 | | - }); |
199 | | -
|
200 | | - create-vscode-extension-update-pr: |
201 | | - runs-on: |
202 | | - group: databricks-deco-testing-runner-group |
203 | | - labels: ubuntu-latest-deco |
204 | | - |
205 | | - needs: goreleaser |
206 | | - |
207 | | - steps: |
208 | | - - name: Set VERSION variable from tag |
209 | | - run: | |
210 | | - VERSION=${{ github.ref_name }} |
211 | | - echo "VERSION=${VERSION:1}" >> $GITHUB_ENV |
212 | | -
|
213 | | - - name: Update CLI version in the VSCode extension |
214 | | - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 |
215 | | - with: |
216 | | - github-token: ${{ secrets.DECO_GITHUB_TOKEN }} |
217 | | - script: | |
218 | | - await github.rest.actions.createWorkflowDispatch({ |
219 | | - owner: 'databricks', |
220 | | - repo: 'databricks-vscode', |
221 | | - workflow_id: 'update-cli-version.yml', |
222 | | - ref: 'main', |
223 | | - inputs: { |
224 | | - version: "${{ env.VERSION }}", |
225 | | - } |
226 | | - }); |
227 | | -
|
228 | | - pypi-publish: |
229 | | - runs-on: |
230 | | - group: databricks-deco-testing-runner-group |
231 | | - labels: ubuntu-latest-deco |
232 | | - |
233 | | - needs: goreleaser |
234 | | - |
235 | | - # IMPORTANT: |
236 | | - # - 'id-token: write' is mandatory for OIDC and trusted publishing to PyPi |
237 | | - # - 'environment: release' is a part of OIDC assertion done by PyPi |
238 | | - # |
239 | | - # See: https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/ |
240 | | - environment: release |
241 | | - permissions: |
242 | | - id-token: write |
243 | | - |
244 | | - steps: |
245 | | - - name: Checkout repository and submodules |
246 | | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
247 | | - with: |
248 | | - fetch-depth: 0 |
249 | | - fetch-tags: true |
250 | | - |
251 | | - - name: Install uv |
252 | | - uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2 |
253 | | - with: |
254 | | - version: "0.6.5" |
255 | | - |
256 | | - - name: Build wheel |
257 | | - working-directory: experimental/python |
258 | | - run: make build |
259 | | - |
260 | | - - name: Publish package distributions to PyPI |
261 | | - uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 |
262 | | - with: |
263 | | - packages-dir: experimental/python/dist |
264 | | - |
265 | | - publish-to-winget-pkgs: |
266 | | - runs-on: |
267 | | - group: databricks-deco-testing-runner-group |
268 | | - labels: ubuntu-latest-deco |
269 | | - |
270 | | - needs: sign-windows |
271 | | - |
272 | | - environment: release |
273 | | - |
274 | | - steps: |
275 | | - - name: Checkout repository and submodules |
276 | | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
277 | | - |
278 | | - # When updating the version of komac, make sure to update the checksum in the next step. |
279 | | - # Find both at https://github.com/russellbanks/Komac/releases. |
280 | | - - name: Download komac binary |
281 | | - run: | |
282 | | - curl -s -L -o $RUNNER_TEMP/komac-2.9.0-x86_64-unknown-linux-gnu.tar.gz https://github.com/russellbanks/Komac/releases/download/v2.9.0/komac-2.9.0-x86_64-unknown-linux-gnu.tar.gz |
283 | | -
|
284 | | - - name: Verify komac binary |
285 | | - run: | |
286 | | - echo "d07a12831ad5418fee715488542a98ce3c0e591d05c850dd149fe78432be8c4c $RUNNER_TEMP/komac-2.9.0-x86_64-unknown-linux-gnu.tar.gz" | sha256sum -c - |
287 | | -
|
288 | | - - name: Untar komac binary to temporary path |
289 | | - run: | |
290 | | - mkdir -p $RUNNER_TEMP/komac |
291 | | - tar -xzf $RUNNER_TEMP/komac-2.9.0-x86_64-unknown-linux-gnu.tar.gz -C $RUNNER_TEMP/komac |
292 | | -
|
293 | | - - name: Add komac to PATH |
294 | | - run: echo "$RUNNER_TEMP/komac" >> $GITHUB_PATH |
295 | | - |
296 | | - - name: Confirm komac version |
297 | | - run: komac --version |
298 | | - |
299 | | - # Use the tag from the input, or the ref name if the input is not provided. |
300 | | - # The ref name is equal to the tag name when this workflow is triggered by the "sign-cli" command. |
301 | | - - name: Strip "v" prefix from version |
302 | | - id: strip_version |
303 | | - run: echo "version=$(echo ${{ github.ref_name }} | sed 's/^v//')" >> "$GITHUB_OUTPUT" |
304 | | - |
305 | | - - name: Get URLs of signed Windows binaries |
306 | | - id: get_windows_urls |
307 | | - run: | |
308 | | - urls=$( |
309 | | - gh api https://api.github.com/repos/databricks/cli/releases/tags/${{ github.ref_name }} | \ |
310 | | - jq -r .assets[].browser_download_url | \ |
311 | | - grep -E '_windows_.*-signed\.zip$' | \ |
312 | | - tr '\n' ' ' |
313 | | - ) |
314 | | - if [ -z "$urls" ]; then |
315 | | - echo "No signed Windows binaries found" >&2 |
316 | | - exit 1 |
317 | | - fi |
318 | | - echo "urls=$urls" >> "$GITHUB_OUTPUT" |
319 | | - env: |
320 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
321 | | - |
322 | | - - name: Publish to Winget |
323 | | - run: | |
324 | | - komac update Databricks.DatabricksCLI \ |
325 | | - --version ${{ steps.strip_version.outputs.version }} \ |
326 | | - --submit \ |
327 | | - --urls ${{ steps.get_windows_urls.outputs.urls }} \ |
328 | | - env: |
329 | | - KOMAC_FORK_OWNER: eng-dev-ecosystem-bot |
330 | | - GITHUB_TOKEN: ${{ secrets.ENG_DEV_ECOSYSTEM_BOT_TOKEN }} |
0 commit comments