@@ -9,24 +9,13 @@ permissions:
99 contents : write
1010
1111jobs :
12- build :
13- strategy :
14- matrix :
15- include :
16- - os : macos-latest
17- target : darwin-arm64
18- artifact : obsidian-cli-darwin-arm64
19- - os : macos-13
20- target : darwin-x64
21- artifact : obsidian-cli-darwin-x64
22- - os : ubuntu-latest
23- target : linux-x64
24- artifact : obsidian-cli-linux-x64
25-
26- runs-on : ${{ matrix.os }}
12+ build-and-release :
13+ runs-on : ubuntu-latest
2714
2815 steps :
2916 - uses : actions/checkout@v4
17+ with :
18+ fetch-depth : 0
3019
3120 - uses : oven-sh/setup-bun@v2
3221 with :
@@ -35,43 +24,16 @@ jobs:
3524 - name : Install dependencies
3625 run : bun install
3726
38- - name : Build binary
39- run : bun build src/index.ts --compile --outfile dist/${{ matrix.artifact }}
40-
41- - name : Upload artifact
42- uses : actions/upload-artifact@v4
43- with :
44- name : ${{ matrix.artifact }}
45- path : dist/${{ matrix.artifact }}
46-
47- release :
48- needs : build
49- runs-on : ubuntu-latest
50-
51- steps :
52- - uses : actions/checkout@v4
53- with :
54- fetch-depth : 0
55-
56- - name : Download all artifacts
57- uses : actions/download-artifact@v4
58- with :
59- path : dist
60-
61- - name : Prepare release assets
27+ - name : Build binaries (cross-compilation)
6228 run : |
63- cd dist
64- for dir in */; do
65- if [ -d "$dir" ]; then
66- mv "$dir"* . 2>/dev/null || true
67- rmdir "$dir" 2>/dev/null || true
68- fi
69- done
70- chmod +x obsidian-cli-*
71- ls -la
29+ mkdir -p dist
30+ bun build src/index.ts --compile --target=bun-darwin-arm64 --outfile dist/obsidian-cli-darwin-arm64
31+ bun build src/index.ts --compile --target=bun-darwin-x64 --outfile dist/obsidian-cli-darwin-x64
32+ bun build src/index.ts --compile --target=bun-linux-x64 --outfile dist/obsidian-cli-linux-x64
33+ chmod +x dist/obsidian-cli-*
34+ ls -la dist/
7235
7336 - name : Generate release notes
74- id : notes
7537 run : |
7638 # Get previous tag
7739 PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
@@ -85,25 +47,27 @@ jobs:
8547 fi
8648
8749 # Write to file for multiline support
88- echo "## What's Changed" > release_notes.md
89- echo "" >> release_notes.md
90- echo "$COMMITS" >> release_notes.md
91- echo "" >> release_notes.md
92- echo "## Installation" >> release_notes.md
93- echo "" >> release_notes.md
94- echo '```bash' >> release_notes.md
95- echo "# macOS (Apple Silicon)" >> release_notes.md
96- echo "curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/obsidian-cli-darwin-arm64 -o /usr/local/bin/obsidian" >> release_notes.md
97- echo "chmod +x /usr/local/bin/obsidian" >> release_notes.md
98- echo "" >> release_notes.md
99- echo "# macOS (Intel)" >> release_notes.md
100- echo "curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/obsidian-cli-darwin-x64 -o /usr/local/bin/obsidian" >> release_notes.md
101- echo "chmod +x /usr/local/bin/obsidian" >> release_notes.md
102- echo "" >> release_notes.md
103- echo "# Linux (x64)" >> release_notes.md
104- echo "curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/obsidian-cli-linux-x64 -o /usr/local/bin/obsidian" >> release_notes.md
105- echo "chmod +x /usr/local/bin/obsidian" >> release_notes.md
106- echo '```' >> release_notes.md
50+ cat > release_notes.md << EOF
51+ ## What's Changed
52+
53+ $COMMITS
54+
55+ ## Installation
56+
57+ \`\`\`bash
58+ # macOS (Apple Silicon)
59+ curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/obsidian-cli-darwin-arm64 -o /usr/local/bin/obsidian
60+ chmod +x /usr/local/bin/obsidian
61+
62+ # macOS (Intel)
63+ curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/obsidian-cli-darwin-x64 -o /usr/local/bin/obsidian
64+ chmod +x /usr/local/bin/obsidian
65+
66+ # Linux (x64)
67+ curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/obsidian-cli-linux-x64 -o /usr/local/bin/obsidian
68+ chmod +x /usr/local/bin/obsidian
69+ \`\`\`
70+ EOF
10771
10872 - name : Create Release
10973 uses : softprops/action-gh-release@v2
0 commit comments