This repository was archived by the owner on Aug 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +68
-0
lines changed Expand file tree Collapse file tree 4 files changed +68
-0
lines changed Original file line number Diff line number Diff line change 53
53
uses : ./ci/image
54
54
with :
55
55
args : ./ci/steps/gendocs.sh
56
+ brew_installs :
57
+ runs-on : macos-latest
58
+ steps :
59
+ - uses : actions/checkout@v1
60
+ - run : brew install --build-from-source ./coder.rb
61
+ - run : coder --version
62
+
Original file line number Diff line number Diff line change
1
+ import { exec } from 'https://cdn.depjs.com/exec/mod.ts'
2
+
3
+ export const currentDir = `${ new URL ( "." , import . meta. url ) . pathname } /../`
4
+
5
+ export const projectRoot = async ( ) => exec ( "git rev-parse --show-toplevel" )
6
+
7
+ export const string = ( a : Uint8Array ) : string => new TextDecoder ( ) . decode ( a )
8
+
9
+ export const bytes = ( a : string ) : Uint8Array => new TextEncoder ( ) . encode ( a )
10
+
11
+ export const read = async ( path : string ) : Promise < string > =>
12
+ string ( await Deno . readFile ( path ) )
13
+
14
+ export const write = async ( path : string , data : string ) : Promise < void > =>
15
+ Deno . writeFile ( path , bytes ( data ) )
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env -S deno run --allow-all
2
+ import { projectRoot , write } from "./lib.ts"
3
+
4
+ Deno . chdir ( await projectRoot ( ) )
5
+
6
+ interface Params {
7
+ sha : string
8
+ version : string
9
+ }
10
+
11
+ const template = ( { sha, version } : Params ) => `class Coder < Formula
12
+ desc "A command-line tool for the Coder remote development platform"
13
+ homepage "https://github.com/cdr/coder-cli"
14
+ url "https://github.com/cdr/coder-cli/releases/download/${ version } /coder-cli-darwin-amd64-${ version } .zip"
15
+ sha256 "${ sha } "
16
+ bottle :unneeded
17
+ def install
18
+ bin.install "coder"
19
+ end
20
+ test do
21
+ system "#{bin}/coder", "--version"
22
+ end
23
+ end
24
+ `
25
+
26
+ if ( Deno . args . length < 2 ) {
27
+ throw Error ( "2 args required" )
28
+ }
29
+
30
+ const version = Deno . args [ 0 ]
31
+ const sha = Deno . args [ 1 ]
32
+
33
+ await write ( "./coder.rb" , template ( { sha, version } ) )
Original file line number Diff line number Diff line change
1
+ class Coder < Formula
2
+ desc "A command-line tool for the Coder remote development platform"
3
+ homepage "https://github.com/cdr/coder-cli"
4
+ url "https://github.com/cdr/coder-cli/releases/download/v1.14.2/coder-cli-darwin-amd64-v1.14.2.zip"
5
+ sha256 "69b69497a75ce19851681974aa7561af7c7061357f8616e24446e58795bf6e1f"
6
+ bottle :unneeded
7
+ def install
8
+ bin . install "coder"
9
+ end
10
+ test do
11
+ system "#{ bin } /coder" , "--version"
12
+ end
13
+ end
You can’t perform that action at this time.
0 commit comments