-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (98 loc) · 3.09 KB
/
publish.yml
File metadata and controls
115 lines (98 loc) · 3.09 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
name: Publish
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Release tag (e.g. v1.0.0)"
required: true
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: bun-darwin-arm64
os: darwin
arch: arm64
- target: bun-darwin-x64
os: darwin
arch: x64
- target: bun-linux-x64
os: linux
arch: x64
- target: bun-linux-arm64
os: linux
arch: arm64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
- run: bun install
- name: Stamp version
run: bun run scripts/set-version.ts
# NOTE: This inline build logic must stay in sync with scripts/build-release.ts.
# If you change the archive structure, version extraction, or checksum format
# here, update build-release.ts to match.
- name: Build and package
run: |
VERSION=$(grep -oP 'ARB_VERSION = "\K[^"]+' src/version.ts)
NAME="arb-${VERSION}-${{ matrix.os }}-${{ matrix.arch }}"
mkdir -p "staging/${NAME}/shell"
bun build src/index.ts --compile --target=${{ matrix.target }} --outfile "staging/${NAME}/arb"
cp shell/arb.zsh shell/arb.bash "staging/${NAME}/shell/"
tar -czf "staging/${NAME}.tar.gz" -C staging "${NAME}"
cd staging
sha256sum "${NAME}.tar.gz" > "${NAME}.tar.gz.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: arb-${{ matrix.os }}-${{ matrix.arch }}
path: staging/*.tar.gz*
upload:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: release
merge-multiple: true
- name: Collect checksums
run: |
cat release/*.sha256 | sort > release/checksums.txt
rm release/*.sha256
- name: Upload release assets
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}"
gh release upload "$TAG" release/*.tar.gz release/checksums.txt
homebrew:
needs: upload
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- run: bun install
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
path: release
merge-multiple: true
- name: Prepare checksums
run: |
mkdir -p dist
cat release/*.sha256 | sort > dist/checksums.txt
- name: Update Homebrew formula
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}"
bun run scripts/update-homebrew.ts "$TAG"