Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3c7076

Browse files
authored
ci: publsh Chocolatey package (#8921)
1 parent95d66ac commitf3c7076

File tree

2 files changed

+100
-7
lines changed

2 files changed

+100
-7
lines changed

‎.github/workflows/release.yaml

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ jobs:
329329
name:Publish to winget-pkgs
330330
runs-on:windows-latest
331331
needs:release
332+
if:${{ !inputs.dry_run }}
332333
steps:
333334
-name:Checkout
334335
uses:actions/checkout@v3
@@ -364,12 +365,6 @@ jobs:
364365
echo "Installer URL: ${installer_url}"
365366
echo "Package version: ${version}"
366367
367-
# Bail if dry-run.
368-
if ($env:CODER_DRY_RUN -match "t") {
369-
echo "Skipping submission due to dry-run."
370-
exit 0
371-
}
372-
373368
# The URL "|X64" suffix forces the architecture as it cannot be
374369
# sniffed properly from the URL. wingetcreate checks both the URL and
375370
# binary magic bytes for the architecture and they need to both match,
@@ -393,7 +388,6 @@ jobs:
393388
WINGET_GH_TOKEN:${{ secrets.CDRCI_GITHUB_TOKEN }}
394389

395390
-name:Comment on PR
396-
if:${{ !inputs.dry_run }}
397391
run:|
398392
# wait 30 seconds
399393
Start-Sleep -Seconds 30.0
@@ -409,3 +403,63 @@ jobs:
409403
# For gh CLI. We need a real token since we're commenting on a PR in a
410404
# different repo.
411405
GH_TOKEN:${{ secrets.CDRCI_GITHUB_TOKEN }}
406+
407+
publish-chocolatey:
408+
name:Publish to Chocolatey
409+
runs-on:windows-latest
410+
needs:release
411+
if:${{ !inputs.dry_run }}
412+
steps:
413+
-name:Checkout
414+
uses:actions/checkout@v3
415+
with:
416+
fetch-depth:0
417+
418+
# Same reason as for release.
419+
-name:Fetch git tags
420+
run:git fetch --tags --force
421+
422+
# From https://chocolatey.org
423+
-name:Install Chocolatey
424+
run:|
425+
Set-ExecutionPolicy Bypass -Scope Process -Force
426+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
427+
428+
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
429+
430+
-name:Build chocolatey package
431+
run:|
432+
cd scripts/chocolatey
433+
434+
# The package version is the same as the tag minus the leading "v".
435+
# The version in this output already has the leading "v" removed but
436+
# we do it again to be safe.
437+
$version = "${{ needs.release.outputs.version }}".Trim('v')
438+
439+
$release_assets = gh release view --repo coder/coder "v${version}" --json assets | `
440+
ConvertFrom-Json
441+
442+
# Get the URL for the Windows ZIP from the release assets.
443+
$zip_url = $release_assets.assets | `
444+
Where-Object name -Match ".*_windows_amd64.zip$" | `
445+
Select -ExpandProperty url
446+
447+
echo "ZIP URL: ${zip_url}"
448+
echo "Package version: ${version}"
449+
450+
echo "Downloading ZIP..."
451+
Invoke-WebRequest $zip_url -OutFile assets.zip
452+
453+
echo "Extracting ZIP..."
454+
Expand-Archive assets.zip -DestinationPath assets/
455+
456+
# No need to specify nuspec if there's only one in the directory.
457+
choco pack --version=$version binary_path=assets/coder.exe
458+
459+
choco apikey --api-key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
460+
461+
# No need to specify nupkg if there's only one in the directory.
462+
choco push --source https://push.chocolatey.org/
463+
464+
env:
465+
CHOCO_API_KEY:${{ secrets.CHOCO_API_KEY }}

‎scripts/chocolatey/coder.nuspec

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Read this before creating packages: https://docs.chocolatey.org/en-us/create/create-packages-->
3+
<!-- It is especially important to read the above link to understand additional requirements when publishing packages to the community feed aka dot org (https://community.chocolatey.org/packages).-->
4+
5+
<!-- Test your packages in a test environment: https://github.com/chocolatey/chocolatey-test-environment-->
6+
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one.-->
7+
<packagexmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
8+
<metadata>
9+
<!-- == PACKAGE SPECIFIC SECTION ==-->
10+
<!-- This section is about this package, although id and version have ties back to the software-->
11+
<!-- id is lowercase and if you want a good separator for words, use '-', not '.'. Dots are only acceptable as suffixes for certain types of packages, e.g. .install, .portable, .extension, .template-->
12+
<!-- If the software is cross-platform, attempt to use the same id as the debian/rpm package(s) if possible.-->
13+
<id>coder</id>
14+
<version>$version$</version>
15+
<packageSourceUrl>https://github.com/coder/coder/blob/main/scripts/chocolatey</packageSourceUrl>
16+
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you.-->
17+
<owners>Coder Technologies\, Inc.</owners>
18+
<!-- ==============================-->
19+
20+
<!-- == SOFTWARE SPECIFIC SECTION ==-->
21+
<!-- This section is about the software itself-->
22+
<title>Coder (Install)</title>
23+
<authors>Coder Technologies\, Inc.</authors>
24+
<projectUrl>https://coder.com</projectUrl>
25+
<iconUrl>https://github.com/coder/presskit/raw/main/logos/coder%20logo%20black%20square.png?raw=true</iconUrl>
26+
<copyright>Coder Technologies, Inc.</copyright>
27+
<licenseUrl>https://coder.com/legal/terms-of-service</licenseUrl>
28+
<requireLicenseAcceptance>true</requireLicenseAcceptance>
29+
<projectSourceUrl>https://github.com/coder/coder.git</projectSourceUrl>
30+
<docsUrl>https://coder.com/docs/v2/latest</docsUrl>
31+
<bugTrackerUrl>https://github.com/coder/coder/issues</bugTrackerUrl>
32+
<tags>coder remote-dev terraform development</tags>
33+
<summary>Remote development environments on your infrastructure provisioned with Terraform</summary>
34+
<description>Remote development environments on your infrastructure provisioned with Terraform</description>
35+
</metadata>
36+
<files>
37+
<filesrc="$binary_path$"target="tools/coder.exe" />
38+
</files>
39+
</package>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp