Skip to content

Commit 8958da1

Browse files
committed
feat: add action workflow for bumping coder-cli
1 parent addaf13 commit 8958da1

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

.github/workflows/bump-coder-cli.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: bump_version
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
default: ""
7+
required: true
8+
description: "unprefixed version number (ex: '1.14.2')"
9+
jobs:
10+
bump:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v1
14+
- run: |
15+
./ci/scripts/bump-coder-cli.sh ${{ github.event.inputs.version }}
16+
git diff
17+
git checkout -b bump-coder-cli-${{ github.event.inputs.version }}
18+
git add coder-cli.rb
19+
git remote add origin "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git"
20+
git commit -m "feat: bump coder-cli version to v$version"
21+
git push --set-upstream origin "$branch"

ci/scripts/bump-coder-cli.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
cd "$(dirname "$0")"
6+
cd "$(git rev-parse --show-toplevel)"
7+
8+
version="$1"
9+
10+
sha() {
11+
sha256sum | awk '{ print $1 }'
12+
}
13+
14+
linux_url="https://github.com/cdr/coder-cli/releases/download/v$version/coder-cli-linux-amd64.tar.gz"
15+
macos_url="https://github.com/cdr/coder-cli/releases/download/v$version/coder-cli-darwin-amd64.zip"
16+
17+
linux_sha="$(curl -sL "$linux_url" | sha)"
18+
macos_sha="$(curl -sL "$macos_url" | sha)"
19+
20+
echo $macos_sha
21+
echo $linux_sha
22+
23+
template=$(cat ./ci/templates/coder-cli.rb)
24+
25+
template="${template//\{\{MACOS_SHA\}\}/$macos_sha}"
26+
template="${template//\{\{LINUX_SHA\}\}/$linux_sha}"
27+
28+
template="${template//\{\{MACOS_URL\}\}/$macos_url}"
29+
template="${template//\{\{LINUX_URL\}\}/$linux_url}"
30+
31+
template="${template//\{\{VERSION\}\}/$version}"
32+
33+
echo "$template" > ./coder-cli.rb

ci/templates/coder-cli.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class CoderCli < Formula
2+
desc "Command-line tool for the Coder remote development platform"
3+
homepage "https://github.com/cdr/coder-cli"
4+
version "{{VERSION}}"
5+
bottle :unneeded
6+
7+
if OS.mac?
8+
url "{{MACOS_URL}}"
9+
sha256 "{{MACOS_SHA}}"
10+
else
11+
url "{{LINUX_URL}}"
12+
sha256 "{{LINUX_SHA}}"
13+
end
14+
15+
def install
16+
bin.install "coder"
17+
end
18+
test do
19+
system "#{bin}/coder", "--version"
20+
end
21+
end

0 commit comments

Comments
 (0)