Skip to content

Commit 543e5c8

Browse files
committed
ci: add action to push chocolatey package
1 parent 795ed3d commit 543e5c8

File tree

13 files changed

+1177
-126
lines changed

13 files changed

+1177
-126
lines changed

.gitattributes

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Auto detect text files and perform normalization
2+
* text=auto eol=lf
3+
14
# Generated files
25
coderd/database/dump.sql linguist-generated=true
36
peerbroker/proto/*.go linguist-generated=true
@@ -7,3 +10,184 @@ provisionersdk/proto/*.go linguist-generated=true
710
*.tfstate.json linguist-generated=true
811
*.tfstate.dot linguist-generated=true
912
*.tfplan.dot linguist-generated=true
13+
14+
# Treat all Go files in this repo as binary, with no git magic updating
15+
# line endings. Windows users contributing to Go will need to use a
16+
# modern version of git and editors capable of LF line endings.
17+
18+
*.go -text diff=golang
19+
20+
21+
## GITATTRIBUTES FOR WEB PROJECTS
22+
#
23+
# These settings are for any web project.
24+
#
25+
# Details per file setting:
26+
# text These files should be normalized (i.e. convert CRLF to LF).
27+
# binary These files are binary and should be left untouched.
28+
#
29+
# Note that binary is a macro for -text -diff.
30+
######################################################################
31+
32+
# Auto detect
33+
## Handle line endings automatically for files detected as
34+
## text and leave all files detected as binary untouched.
35+
## This will handle all files NOT defined below.
36+
* text=auto
37+
38+
# Source code
39+
*.bash text eol=lf
40+
*.sh text eol=lf
41+
*.bat text eol=crlf
42+
*.cmd text eol=crlf
43+
*.coffee text
44+
*.css text diff=css
45+
*.htm text diff=html
46+
*.html text diff=html
47+
*.inc text
48+
*.ini text
49+
*.js text
50+
*.json text
51+
*.jsx text
52+
*.less text
53+
*.ls text
54+
*.map text -diff
55+
*.od text
56+
*.onlydata text
57+
*.php text diff=php
58+
*.pl text
59+
*.ps1 text eol=crlf
60+
*.py text diff=python
61+
*.rb text diff=ruby
62+
*.sass text
63+
*.scm text
64+
*.scss text diff=css
65+
.husky/* text eol=lf
66+
*.sql text
67+
*.styl text
68+
*.tag text
69+
*.ts text
70+
*.tsx text
71+
*.xml text
72+
*.xhtml text diff=html
73+
*.wxs text eol=crlf
74+
*.nuspec text eol=crlf
75+
76+
# Docker
77+
Dockerfile text
78+
79+
# Documentation
80+
*.ipynb text
81+
*.markdown text diff=markdown
82+
*.md text diff=markdown
83+
*.mdwn text diff=markdown
84+
*.mdown text diff=markdown
85+
*.mkd text diff=markdown
86+
*.mkdn text diff=markdown
87+
*.mdtxt text
88+
*.mdtext text
89+
*.txt text
90+
AUTHORS text
91+
CHANGELOG text
92+
CHANGES text
93+
CONTRIBUTING text
94+
COPYING text
95+
copyright text
96+
*COPYRIGHT* text
97+
INSTALL text
98+
license text
99+
LICENSE text
100+
NEWS text
101+
readme text
102+
*README* text
103+
TODO text
104+
105+
# Templates
106+
*.dot text
107+
*.ejs text
108+
*.erb text
109+
*.haml text
110+
*.handlebars text
111+
*.hbs text
112+
*.hbt text
113+
*.jade text
114+
*.latte text
115+
*.mustache text
116+
*.njk text
117+
*.phtml text
118+
*.svelte text
119+
*.tmpl text
120+
*.tpl text
121+
*.twig text
122+
*.vue text
123+
124+
# Configs
125+
*.cnf text
126+
*.conf text
127+
*.config text
128+
.editorconfig text
129+
.env text
130+
.gitattributes text
131+
.gitconfig text
132+
.htaccess text
133+
*.lock text -diff
134+
package.json text eol=lf
135+
package-lock.json text eol=lf -diff
136+
pnpm-lock.yaml text eol=lf -diff
137+
.prettierrc text
138+
yarn.lock text -diff
139+
*.toml text
140+
*.yaml text
141+
*.yml text
142+
browserslist text
143+
Makefile text
144+
makefile text
145+
146+
# Heroku
147+
Procfile text
148+
149+
# Graphics
150+
*.ai binary
151+
*.bmp binary
152+
*.eps binary
153+
*.gif binary
154+
*.gifv binary
155+
*.ico binary
156+
*.jng binary
157+
*.jp2 binary
158+
*.jpg binary
159+
*.jpeg binary
160+
*.jpx binary
161+
*.jxr binary
162+
*.pdf binary
163+
*.png binary
164+
*.psb binary
165+
*.psd binary
166+
# SVG treated as an asset (binary) by default.
167+
*.svg text
168+
# If you want to treat it as binary,
169+
# use the following line instead.
170+
# *.svg binary
171+
*.svgz binary
172+
*.tif binary
173+
*.tiff binary
174+
*.wbmp binary
175+
*.webp binary
176+
177+
# Archives
178+
*.7z binary
179+
*.gz binary
180+
*.jar binary
181+
*.rar binary
182+
*.tar binary
183+
*.zip binary
184+
185+
# Executables
186+
*.exe binary
187+
*.pyc binary
188+
189+
# RC files (like .babelrc or .eslintrc)
190+
*.*rc text
191+
192+
# Ignore files (like .npmignore or .gitignore)
193+
*.*ignore text

.github/actions/chocolatey/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM alpine:3.16
2+
3+
ARG CHOCOVERSION=1.1.0
4+
5+
RUN apk add --no-cache bash ca-certificates git \
6+
&& apk --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing add mono mono-dev \
7+
&& cert-sync /etc/ssl/certs/ca-certificates.crt \
8+
&& wget "https://github.com/chocolatey/choco/archive/${CHOCOVERSION}.tar.gz" -O- | tar -xzf - \
9+
&& cd choco-"${CHOCOVERSION}" \
10+
&& chmod +x build.sh zip.sh \
11+
&& ./build.sh -v \
12+
&& mv ./code_drop/chocolatey/console /opt/chocolatey \
13+
&& mkdir -p /opt/chocolatey/lib \
14+
&& rm -rf /choco-"${CHOCOVERSION}" \
15+
&& apk del mono-dev \
16+
&& rm -rf /var/cache/apk/*
17+
18+
ENV ChocolateyInstall=/opt/chocolatey
19+
COPY entrypoint.sh /entrypoint.sh
20+
ENTRYPOINT ["/entrypoint.sh"]

.github/actions/chocolatey/action.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "Chocolatey publish action"
2+
description: "Creates package for Chocolatey and pushes it"
3+
inputs:
4+
version:
5+
description: "Package version"
6+
required: false
7+
chocolateyKey:
8+
description: "Chocolatey API key"
9+
required: false
10+
publish:
11+
description: "Whether package should be published"
12+
required: false
13+
default: "false"
14+
runs:
15+
using: "docker"
16+
image: "Dockerfile"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
function choco {
6+
mono /opt/chocolatey/choco.exe "$@" --allow-unofficial --nocolor
7+
}
8+
9+
rm -f coder.*.nupkg
10+
11+
mkdir -p tools
12+
cp LICENSE tools/LICENSE.txt
13+
cp VERIFICATION tools/VERIFICATION.txt
14+
# chocolatey doesn't support ARM
15+
cp ./build/coder_*_windows_amd64.exe tools/
16+
17+
choco pack coder.nuspec --version "${INPUT_VERSION}"
18+
19+
if [[ "$INPUT_PUBLISH" == "true" ]]; then
20+
choco push coder."${INPUT_VERSION}".nupkg --api-key "${INPUT_CHOCOLATEYKEY}" -s https://push.chocolatey.org/ --timeout 180
21+
fi

0 commit comments

Comments
 (0)