From cfda410e2133b01c700cc80dc907e0150963e1a5 Mon Sep 17 00:00:00 2001 From: panekj Date: Sun, 23 Oct 2022 14:18:09 +0200 Subject: [PATCH 1/4] ci: add action to push chocolatey package --- .github/actions/chocolatey/Dockerfile | 20 ++++++++++++++++++ .github/actions/chocolatey/action.yml | 16 +++++++++++++++ .github/actions/chocolatey/entrypoint.sh | 21 +++++++++++++++++++ .github/workflows/release.yaml | 8 ++++++++ VERIFICATION | 5 +++++ coder.nuspec | 26 ++++++++++++++++++++++++ 6 files changed, 96 insertions(+) create mode 100644 .github/actions/chocolatey/Dockerfile create mode 100644 .github/actions/chocolatey/action.yml create mode 100755 .github/actions/chocolatey/entrypoint.sh create mode 100644 VERIFICATION create mode 100644 coder.nuspec diff --git a/.github/actions/chocolatey/Dockerfile b/.github/actions/chocolatey/Dockerfile new file mode 100644 index 0000000000000..acfaa369400e9 --- /dev/null +++ b/.github/actions/chocolatey/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine:latest + +ARG CHOCOVERSION=1.1.0 + +RUN apk add --no-cache bash ca-certificates git \ + && apk --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing add mono mono-dev \ + && cert-sync /etc/ssl/certs/ca-certificates.crt \ + && wget "https://github.com/chocolatey/choco/archive/${CHOCOVERSION}.tar.gz" -O- | tar -xzf - \ + && cd choco-"${CHOCOVERSION}" \ + && chmod +x build.sh zip.sh \ + && ./build.sh -v \ + && mv ./code_drop/chocolatey/console /opt/chocolatey \ + && mkdir -p /opt/chocolatey/lib \ + && rm -rf /choco-"${CHOCOVERSION}" \ + && apk del mono-dev \ + && rm -rf /var/cache/apk/* + +ENV ChocolateyInstall=/opt/chocolatey +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/chocolatey/action.yml b/.github/actions/chocolatey/action.yml new file mode 100644 index 0000000000000..a6724cf38c44c --- /dev/null +++ b/.github/actions/chocolatey/action.yml @@ -0,0 +1,16 @@ +name: 'Chocolatey publish action' +description: 'Creates package for Chocolatey and pushes it' +inputs: + version: + description: 'Package version' + required: false + chocolateyKey: + description: 'Chocolatey API key' + required: false + publish: + description: 'Whether package should be published' + required: false + default: 'false' +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/chocolatey/entrypoint.sh b/.github/actions/chocolatey/entrypoint.sh new file mode 100755 index 0000000000000..ccd0a7228bf9f --- /dev/null +++ b/.github/actions/chocolatey/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +function choco { + mono /opt/chocolatey/choco.exe "$@" --allow-unofficial --nocolor +} + +rm -f coder.*.nupkg + +mkdir -p tools +cp LICENSE tools/LICENSE.txt +cp VERIFICATION tools/VERIFICATION.txt +sed -i "s/VERSION/${INPUT_VERSION}/g" tools/VERIFICATION.txt +cp ./build/coder_*_windows_amd64.exe tools/ + +choco pack coder.nuspec --version "${INPUT_VERSION}" + +if [[ "$INPUT_PUBLISH" == "true" ]]; then + choco push coder."${INPUT_VERSION}".nupkg --api-key "${INPUT_CHOCOLATEYKEY}" -s https://push.chocolatey.org/ --timeout 180 +fi diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a209df4343592..46d21bcc409f7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -104,6 +104,7 @@ jobs: go mod download version="$(./scripts/version.sh)" + echo "CODER_RELEASE_VERSION=$version" >> $GITHUB_ENV make gen/mark-fresh make -j \ build/coder_"$version"_linux_{amd64,armv7,arm64}.{tar.gz,apk,deb,rpm} \ @@ -180,3 +181,10 @@ jobs: ./build/*.deb ./build/*.rpm retention-days: 7 + + - name: Publish to Chocolatey + uses: ./.github/actions/chocolatey + with: + publish: ${{ ! (github.event.inputs.dry_run || github.event.inputs.snapshot) }} + version: ${{ env.CODER_RELEASE_VERSION }} + chocolateyKey: ${{ secrets.CHOCOLATEY_KEY }} diff --git a/VERIFICATION b/VERIFICATION new file mode 100644 index 0000000000000..a94876c318204 --- /dev/null +++ b/VERIFICATION @@ -0,0 +1,5 @@ +VERIFICATION +Verification is intended to assist the Chocolatey moderators and community +in verifying that this package's contents are trustworthy. + +Checksums: https://github.com/coder/coder/releases, in the coder_VERSION_checksums.txt file diff --git a/coder.nuspec b/coder.nuspec new file mode 100644 index 0000000000000..aedcbef6dd4ba --- /dev/null +++ b/coder.nuspec @@ -0,0 +1,26 @@ + + + + + coder + 0.0.0 + https://github.com/coder/coder + coder + coder + coder + https://coder.com + https://github.com/coder/presskit/raw/main/logos/coder%20logo%20black%20square.png + Coder + https://raw.githubusercontent.com/coder/coder/main/LICENSE + true + https://github.com/coder/coder + https://coder.com/docs/coder-oss/latest + https://github.com/coder/coder/issues + golang + Remote development environments on your infrastructure provisioned with Terraform + Remote development environments on your infrastructure provisioned with Terraform + + + + + From 0002e45e0321041061a9b2a402bab6062648f744 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Wed, 9 Nov 2022 21:57:03 +1000 Subject: [PATCH 2/4] Update .github/actions/chocolatey/entrypoint.sh Co-authored-by: Gary Ewan Park --- .github/actions/chocolatey/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/chocolatey/entrypoint.sh b/.github/actions/chocolatey/entrypoint.sh index ccd0a7228bf9f..be73ae9bf3dcd 100755 --- a/.github/actions/chocolatey/entrypoint.sh +++ b/.github/actions/chocolatey/entrypoint.sh @@ -17,5 +17,5 @@ cp ./build/coder_*_windows_amd64.exe tools/ choco pack coder.nuspec --version "${INPUT_VERSION}" if [[ "$INPUT_PUBLISH" == "true" ]]; then - choco push coder."${INPUT_VERSION}".nupkg --api-key "${INPUT_CHOCOLATEYKEY}" -s https://push.chocolatey.org/ --timeout 180 + choco push coder."${INPUT_VERSION}".nupkg --api-key="${INPUT_CHOCOLATEYKEY}" --source="https://push.chocolatey.org/" --timeout 180 fi From f4baf27d947a12c0684a4409e1246052c6edcfa4 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Wed, 9 Nov 2022 12:15:18 +0000 Subject: [PATCH 3/4] update nuspec --- coder.nuspec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coder.nuspec b/coder.nuspec index aedcbef6dd4ba..a4e1f2130aa0c 100644 --- a/coder.nuspec +++ b/coder.nuspec @@ -10,15 +10,15 @@ coder https://coder.com https://github.com/coder/presskit/raw/main/logos/coder%20logo%20black%20square.png - Coder + Coder Technologies Inc https://raw.githubusercontent.com/coder/coder/main/LICENSE - true + false https://github.com/coder/coder https://coder.com/docs/coder-oss/latest https://github.com/coder/coder/issues golang - Remote development environments on your infrastructure provisioned with Terraform - Remote development environments on your infrastructure provisioned with Terraform + Software development on your infrastructure. Offload your team's development from local workstations to cloud servers. Onboard developers in minutes. Build, test and compile at the speed of the cloud. Keep your source code and data behind your firewall. + Software development on your infrastructure. Offload your team's development from local workstations to cloud servers. Onboard developers in minutes. Build, test and compile at the speed of the cloud. Keep your source code and data behind your firewall. From 99e8656f4dec53414454f12efc8f756657a12a12 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Wed, 9 Nov 2022 12:54:53 +0000 Subject: [PATCH 4/4] add licenses and moved verification --- .github/actions/chocolatey/VERIFICATION.txt | 8 ++++++++ VERIFICATION | 5 ----- coder.nuspec | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 .github/actions/chocolatey/VERIFICATION.txt delete mode 100644 VERIFICATION diff --git a/.github/actions/chocolatey/VERIFICATION.txt b/.github/actions/chocolatey/VERIFICATION.txt new file mode 100644 index 0000000000000..4d18877b68b0a --- /dev/null +++ b/.github/actions/chocolatey/VERIFICATION.txt @@ -0,0 +1,8 @@ +VERIFICATION + +Verification is intended to assist the Chocolatey moderators and community +in verifying that this package's contents are trustworthy. + +The installer has been downloaded from https://github.com/coder/coder/releases + +Checksums can be found in the coder_VERSION_checksums.txt at https://github.com/coder/coder/releases diff --git a/VERIFICATION b/VERIFICATION deleted file mode 100644 index a94876c318204..0000000000000 --- a/VERIFICATION +++ /dev/null @@ -1,5 +0,0 @@ -VERIFICATION -Verification is intended to assist the Chocolatey moderators and community -in verifying that this package's contents are trustworthy. - -Checksums: https://github.com/coder/coder/releases, in the coder_VERSION_checksums.txt file diff --git a/coder.nuspec b/coder.nuspec index a4e1f2130aa0c..e1938d26bdc53 100644 --- a/coder.nuspec +++ b/coder.nuspec @@ -22,5 +22,8 @@ + + +