From 01bccb61b795ef0f5a0bcc3e4ad1a2cba3ea381f Mon Sep 17 00:00:00 2001
From: Phorcys <57866459+phorcys420@users.noreply.github.com>
Date: Sun, 6 Aug 2023 10:47:13 +0000
Subject: [PATCH 1/8] ci: add Chocolatey manifest
---
scripts/chocolatey/coder.nuspec | 39 +++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 scripts/chocolatey/coder.nuspec
diff --git a/scripts/chocolatey/coder.nuspec b/scripts/chocolatey/coder.nuspec
new file mode 100644
index 0000000000000..a8c593485e3ce
--- /dev/null
+++ b/scripts/chocolatey/coder.nuspec
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ coder
+ $version$
+ https://github.com/coder/coder/blob/main/scripts/chocolatey
+
+ Coder Technologies\, Inc.
+
+
+
+
+ Coder (Install)
+ Coder Technologies\, Inc.
+ https://coder.com
+ https://github.com/coder/presskit/raw/main/logos/coder%20logo%20black%20square.png?raw=true
+ Coder Technologies, Inc.
+ https://github.com/coder/coder/blob/main/LICENSE
+ true
+ https://github.com/coder/coder.git
+ https://coder.com/docs/v2/latest
+ https://github.com/coder/coder/issues
+ coder remote-dev terraform development
+ Remote development environments on your infrastructure provisioned with Terraform
+ Remote development environments on your infrastructure provisioned with Terraform
+
+
+
+
+
From ea2a19388ee014076b69b77b88b39139b4c5bc92 Mon Sep 17 00:00:00 2001
From: Phorcys <57866459+phorcys420@users.noreply.github.com>
Date: Sat, 5 Aug 2023 22:18:55 +0000
Subject: [PATCH 2/8] ci: add chocolatey job to release action
---
.github/workflows/release.yaml | 67 ++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index ab27aa12d117c..9a4565e1a705a 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -409,3 +409,70 @@ jobs:
# For gh CLI. We need a real token since we're commenting on a PR in a
# different repo.
GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}
+
+ publish-chocolatey:
+ name: Publish to Chocolatey
+ runs-on: windows-latest
+ needs: release
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ # Same reason as for release.
+ - name: Fetch git tags
+ run: git fetch --tags --force
+
+ # From https://chocolatey.org
+ - name: Install Chocolatey
+ run: |
+ Set-ExecutionPolicy Bypass -Scope Process -Force;
+ [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
+
+ iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
+
+ - name: Build chocolatey package
+ run: |
+ cd scripts/chocolatey
+
+ # The package version is the same as the tag minus the leading "v".
+ # The version in this output already has the leading "v" removed but
+ # we do it again to be safe.
+ $version = "${{ needs.release.outputs.version }}".Trim('v')
+
+ $release_assets = gh release view --repo coder/coder "v${version}" --json assets | `
+ ConvertFrom-Json
+
+ # Get the URL for the Windows ZIP from the release assets.
+ $zip_url = $release_assets.assets | `
+ Where-Object name -Match ".*_windows_amd64.zip$" | `
+ Select -ExpandProperty url
+
+ echo "ZIP URL: ${zip_url}"
+ echo "Package version: ${version}"
+
+ echo "Downloading ZIP..."
+ Invoke-WebRequest $zip_url -OutFile assets.zip
+
+ echo "Extracting ZIP..."
+ Expand-Archive assets.zip -DestinationPath assets/
+
+ # No need to specify nuspec if there's only one in the directory.
+ choco pack --version=$version binary_path=assets/coder.exe
+
+ # Bail if dry-run.
+ if ($env:CODER_DRY_RUN -match "t") {
+ echo "Skipping submission due to dry-run."
+ exit 0
+ }
+
+ choco apikey --api-key $env:CHOCO_API_KEY -source https://push.chocolatey.org/
+
+ # No need to specify nupkg if there's only one in the directory.
+ choco push --source https://push.chocolatey.org/
+
+ env:
+ # For gh CLI. We need a real token since we're commenting on a PR in a
+ # different repo.
+ CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
From 9222a8d657c7a969c19231313ed02192a33ba281 Mon Sep 17 00:00:00 2001
From: Phorcys <57866459+phorcys420@users.noreply.github.com>
Date: Sun, 6 Aug 2023 07:10:36 +0000
Subject: [PATCH 3/8] chore(ci): do not run winget/chocolatey in dry-run
---
.github/workflows/release.yaml | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 9a4565e1a705a..d49e12425a3e6 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -329,6 +329,7 @@ jobs:
name: Publish to winget-pkgs
runs-on: windows-latest
needs: release
+ if: ${{ !inputs.dry_run }}
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -364,12 +365,6 @@ jobs:
echo "Installer URL: ${installer_url}"
echo "Package version: ${version}"
- # Bail if dry-run.
- if ($env:CODER_DRY_RUN -match "t") {
- echo "Skipping submission due to dry-run."
- exit 0
- }
-
# The URL "|X64" suffix forces the architecture as it cannot be
# sniffed properly from the URL. wingetcreate checks both the URL and
# binary magic bytes for the architecture and they need to both match,
@@ -393,7 +388,6 @@ jobs:
WINGET_GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}
- name: Comment on PR
- if: ${{ !inputs.dry_run }}
run: |
# wait 30 seconds
Start-Sleep -Seconds 30.0
@@ -414,6 +408,7 @@ jobs:
name: Publish to Chocolatey
runs-on: windows-latest
needs: release
+ if: ${{ !inputs.dry_run }}
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -461,12 +456,6 @@ jobs:
# No need to specify nuspec if there's only one in the directory.
choco pack --version=$version binary_path=assets/coder.exe
- # Bail if dry-run.
- if ($env:CODER_DRY_RUN -match "t") {
- echo "Skipping submission due to dry-run."
- exit 0
- }
-
choco apikey --api-key $env:CHOCO_API_KEY -source https://push.chocolatey.org/
# No need to specify nupkg if there's only one in the directory.
From 09c4ce21510a9e188279eaae206b9cd3d4394ddc Mon Sep 17 00:00:00 2001
From: Phorcys <57866459+phorcys420@users.noreply.github.com>
Date: Wed, 9 Aug 2023 13:27:34 +0000
Subject: [PATCH 4/8] ci: update license in chocolatey nuspec
---
scripts/chocolatey/coder.nuspec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/chocolatey/coder.nuspec b/scripts/chocolatey/coder.nuspec
index a8c593485e3ce..6e9814821088c 100644
--- a/scripts/chocolatey/coder.nuspec
+++ b/scripts/chocolatey/coder.nuspec
@@ -24,7 +24,7 @@
https://coder.com
https://github.com/coder/presskit/raw/main/logos/coder%20logo%20black%20square.png?raw=true
Coder Technologies, Inc.
- https://github.com/coder/coder/blob/main/LICENSE
+ https://github.com/coder/coder/blob/main/LICENSE.enterprise
true
https://github.com/coder/coder.git
https://coder.com/docs/v2/latest
From 7de6b6e6fb90b95c480d192ed755a69500f4e26a Mon Sep 17 00:00:00 2001
From: phorcys420 <57866459+phorcys420@users.noreply.github.com>
Date: Tue, 15 Aug 2023 17:02:18 +0200
Subject: [PATCH 5/8] ci: update chocolatey license to ToS
Co-authored-by: Muhammad Atif Ali
---
scripts/chocolatey/coder.nuspec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/chocolatey/coder.nuspec b/scripts/chocolatey/coder.nuspec
index 6e9814821088c..65751f257e436 100644
--- a/scripts/chocolatey/coder.nuspec
+++ b/scripts/chocolatey/coder.nuspec
@@ -24,7 +24,7 @@
https://coder.com
https://github.com/coder/presskit/raw/main/logos/coder%20logo%20black%20square.png?raw=true
Coder Technologies, Inc.
- https://github.com/coder/coder/blob/main/LICENSE.enterprise
+ https://coder.com/legal/terms-of-service
true
https://github.com/coder/coder.git
https://coder.com/docs/v2/latest
From b69f74e68ddee5c764067300fd0b0a1b1276ba49 Mon Sep 17 00:00:00 2001
From: phorcys420 <57866459+phorcys420@users.noreply.github.com>
Date: Wed, 16 Aug 2023 11:31:14 +0200
Subject: [PATCH 6/8] ci: remove semicolons from chocolatey install script
Co-authored-by: Dean Sheather
---
.github/workflows/release.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index d49e12425a3e6..07dbd883045d5 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -422,8 +422,8 @@ jobs:
# From https://chocolatey.org
- name: Install Chocolatey
run: |
- Set-ExecutionPolicy Bypass -Scope Process -Force;
- [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
+ Set-ExecutionPolicy Bypass -Scope Process -Force
+ [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
From eda20c12b9657a7b02ffadb74e235d144329a3ed Mon Sep 17 00:00:00 2001
From: phorcys420 <57866459+phorcys420@users.noreply.github.com>
Date: Wed, 16 Aug 2023 11:31:53 +0200
Subject: [PATCH 7/8] ci: remove useless comment from chocolatey workflow
Co-authored-by: Dean Sheather
---
.github/workflows/release.yaml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 07dbd883045d5..2efcba98cb953 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -462,6 +462,4 @@ jobs:
choco push --source https://push.chocolatey.org/
env:
- # For gh CLI. We need a real token since we're commenting on a PR in a
- # different repo.
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
From d8e18a5ed9562e465f9ede02228fc27760522103 Mon Sep 17 00:00:00 2001
From: phorcys420 <57866459+phorcys420@users.noreply.github.com>
Date: Wed, 16 Aug 2023 13:26:50 +0200
Subject: [PATCH 8/8] fix(ci): fix typo in `choco apikey` command
Co-authored-by: Muhammad Atif Ali
---
.github/workflows/release.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 2efcba98cb953..de1688f1640b1 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -456,7 +456,7 @@ jobs:
# No need to specify nuspec if there's only one in the directory.
choco pack --version=$version binary_path=assets/coder.exe
- choco apikey --api-key $env:CHOCO_API_KEY -source https://push.chocolatey.org/
+ choco apikey --api-key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
# No need to specify nupkg if there's only one in the directory.
choco push --source https://push.chocolatey.org/