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
name: release
on:
push:
tags:
permissions:
contents: write
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: false
jobs:
build:
name: build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-14
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
- target: x86_64-unknown-linux-gnu
os: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: build
run: cargo build --release --locked --bin mind --target ${{ matrix.target }}
- name: package
run: |
version="${GITHUB_REF_NAME#v}"
dist="mind-${version}-${{ matrix.target }}"
mkdir "$dist"
cp "target/${{ matrix.target }}/release/mind" "$dist/"
tar -czf "${dist}.tar.gz" -C "$dist" mind
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.target }}
path: mind-*.tar.gz
release:
needs: build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: create release
env:
GH_TOKEN: ${{ github.token }}
run: |
version="${GITHUB_REF_NAME#v}"
bash resources/changelog-section.sh "$version" > notes.md
gh release create "$GITHUB_REF_NAME" dist/*.tar.gz --title "$GITHUB_REF_NAME" --notes-file notes.md
formula:
needs: release
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
ref: main
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: regenerate formula
run: bash resources/update-formula.sh "${GITHUB_REF_NAME#v}" dist Formula/mind.rb
- name: commit formula
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Formula/mind.rb
if git diff --cached --quiet; then
echo "formula already up to date"
else
git commit -m "release: update mind formula to ${GITHUB_REF_NAME#v}"
git push origin main
fi