-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (100 loc) · 3.76 KB
/
Copy pathrelease.yml
File metadata and controls
118 lines (100 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build all targets
run: |
set -euo pipefail
mkdir -p dist
build() {
local target="$1"
local artifact="$2"
bun build src/cli.tsx --compile --target="${target}" --outfile=colflow
tar -czvf "dist/${artifact}.tar.gz" colflow
sha256sum "dist/${artifact}.tar.gz" | awk '{print $1}' > "dist/${artifact}.sha256"
rm colflow
}
build bun-darwin-arm64 colflow-darwin-arm64
build bun-darwin-x64 colflow-darwin-amd64
build bun-linux-x64 colflow-linux-amd64
build bun-linux-arm64 colflow-linux-arm64
- name: Read sha256s
id: hashes
run: |
echo "darwin_arm64_sha=$(cat dist/colflow-darwin-arm64.sha256)" >> "$GITHUB_OUTPUT"
echo "darwin_amd64_sha=$(cat dist/colflow-darwin-amd64.sha256)" >> "$GITHUB_OUTPUT"
echo "linux_amd64_sha=$(cat dist/colflow-linux-amd64.sha256)" >> "$GITHUB_OUTPUT"
echo "linux_arm64_sha=$(cat dist/colflow-linux-arm64.sha256)" >> "$GITHUB_OUTPUT"
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
dist/colflow-darwin-arm64.tar.gz
dist/colflow-darwin-amd64.tar.gz
dist/colflow-linux-amd64.tar.gz
dist/colflow-linux-arm64.tar.gz
generate_release_notes: true
- name: Update Homebrew formula
env:
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
DARWIN_ARM64_SHA: ${{ steps.hashes.outputs.darwin_arm64_sha }}
DARWIN_AMD64_SHA: ${{ steps.hashes.outputs.darwin_amd64_sha }}
LINUX_AMD64_SHA: ${{ steps.hashes.outputs.linux_amd64_sha }}
LINUX_ARM64_SHA: ${{ steps.hashes.outputs.linux_arm64_sha }}
run: |
VERSION="${TAG#v}"
REPO="https://github.com/CogappLabs/colflow-cli-react/releases/download/${TAG}"
cat > colflow.rb <<FORMULA
class Colflow < Formula
desc "TUI for Dagster collection-flow pipelines"
homepage "https://github.com/CogappLabs/colflow-cli-react"
version "${VERSION}"
license "MIT"
on_macos do
if Hardware::CPU.arm?
url "${REPO}/colflow-darwin-arm64.tar.gz"
sha256 "${DARWIN_ARM64_SHA}"
else
url "${REPO}/colflow-darwin-amd64.tar.gz"
sha256 "${DARWIN_AMD64_SHA}"
end
end
on_linux do
if Hardware::CPU.arm?
url "${REPO}/colflow-linux-arm64.tar.gz"
sha256 "${LINUX_ARM64_SHA}"
else
url "${REPO}/colflow-linux-amd64.tar.gz"
sha256 "${LINUX_AMD64_SHA}"
end
end
def install
bin.install "colflow"
end
test do
system "#{bin}/colflow", "--help"
end
end
FORMULA
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git clone \
"https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/CogappLabs/homebrew-tap.git" \
tap-repo
cp colflow.rb tap-repo/Formula/colflow.rb
cd tap-repo
git add Formula/colflow.rb
git commit -m "colflow ${TAG}"
git push