Repository navigation
164 lines (140 loc) · 5.08 KB
/
Copy pathrelease.yml
File metadata and controls
164 lines (140 loc) · 5.08 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: macos-14
target: darwin-arm64
- os: macos-13
target: darwin-x64
- os: ubuntu-latest
target: linux-x64
# Note: linux-arm64 requires native ARM runner, skipped for now
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build binary
run: |
cat > build-single.ts << 'EOF'
import solidPlugin from "./node_modules/@opentui/solid/scripts/solid-plugin";
const target = process.argv[2];
const result = await Bun.build({
entrypoints: ["./src/index.tsx"],
target: "bun",
plugins: [solidPlugin],
minify: true,
compile: {
target: `bun-${target}` as any,
outfile: `dist/devproc-${target}`,
},
});
if (!result.success) {
console.error("Build failed:", result.logs);
process.exit(1);
}
EOF
mkdir -p dist
bun run build-single.ts ${{ matrix.target }}
- name: Create tarball
run: |
cd dist
# Rename binary to 'devproc' for the tarball
mv devproc-${{ matrix.target }} devproc
tar -czf devproc-${{ github.ref_name }}-${{ matrix.target }}.tar.gz devproc
shasum -a 256 devproc-${{ github.ref_name }}-${{ matrix.target }}.tar.gz > devproc-${{ github.ref_name }}-${{ matrix.target }}.tar.gz.sha256
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: devproc-${{ matrix.target }}
path: |
dist/devproc-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
dist/devproc-${{ github.ref_name }}-${{ matrix.target }}.tar.gz.sha256
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create checksums and get SHAs
id: checksums
run: |
cd artifacts
cat *.sha256 > checksums.txt
cat checksums.txt
# Extract just the hash (first field) from each .sha256 file
echo "darwin_arm64=$(cat *darwin-arm64*.sha256 | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "darwin_x64=$(cat *darwin-x64*.sha256 | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "linux_x64=$(cat *linux-x64*.sha256 | awk '{print $1}')" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/*.tar.gz
artifacts/checksums.txt
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref, '-') }}
- name: Extract version
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
- name: Update Homebrew formula
run: |
VERSION="${{ steps.version.outputs.version }}"
DARWIN_ARM64="${{ steps.checksums.outputs.darwin_arm64 }}"
DARWIN_X64="${{ steps.checksums.outputs.darwin_x64 }}"
LINUX_X64="${{ steps.checksums.outputs.linux_x64 }}"
cat > Formula/devproc.rb << EOF
# typed: false
# frozen_string_literal: true
class Devproc < Formula
desc "Terminal UI for managing local development environments"
homepage "https://github.com/captjt/devproc"
version "${VERSION}"
license "MIT"
on_macos do
if Hardware::CPU.arm?
url "https://github.com/captjt/devproc/releases/download/v${VERSION}/devproc-v${VERSION}-darwin-arm64.tar.gz"
sha256 "${DARWIN_ARM64}"
else
url "https://github.com/captjt/devproc/releases/download/v${VERSION}/devproc-v${VERSION}-darwin-x64.tar.gz"
sha256 "${DARWIN_X64}"
end
end
on_linux do
url "https://github.com/captjt/devproc/releases/download/v${VERSION}/devproc-v${VERSION}-linux-x64.tar.gz"
sha256 "${LINUX_X64}"
end
def install
bin.install "devproc"
end
test do
assert_match "DevProc v#{version}", shell_output("#{bin}/devproc --version")
end
end
EOF
- name: Commit formula update
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/devproc.rb
git commit -m "Update Homebrew formula to v${{ steps.version.outputs.version }}"
git push origin HEAD:master