Repository navigation
95 lines (90 loc) · 2.83 KB
/
Copy pathrelease.yml
File metadata and controls
95 lines (90 loc) · 2.83 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
name: release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
target: aarch64-apple-darwin
name: macos-arm64
- os: macos-15-intel
target: x86_64-apple-darwin
name: macos-x86_64
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
name: linux-x86_64
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
name: linux-arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: build
run: |
cargo build --release --target ${{ matrix.target }}
ver="${GITHUB_REF_NAME#v}"
out="gitgui-${ver}-${{ matrix.name }}"
cp "target/${{ matrix.target }}/release/gitgui" "$out"
tar czf "${out}.tar.gz" "$out"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: gitgui-*.tar.gz
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
# Every release opens with how to install and update it; the generated
# notes (commits, contributors) are appended after this body.
- name: release body
run: sed "s/VERSION/${GITHUB_REF_NAME#v}/g" .github/release-body.md > body.md
- name: publish
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*
generate_release_notes: true
body_path: body.md
# After the assets exist, regenerate the Homebrew formula on main from their
# sha256 digests, so `brew upgrade` picks the release up.
formula:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: bump the formula
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version="${GITHUB_REF_NAME#v}"
# The digests appear a moment after the upload, so retry a few times.
for attempt in 1 2 3 4 5; do
python3 scripts/formula.py "$version" && break
if [ "$attempt" = 5 ]; then exit 1; fi
sleep 15
done
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Formula/gitgui.rb
if git diff --cached --quiet; then
echo "formula already up to date"
exit 0
fi
git commit -m "brew: gitgui $version [skip ci]"
git push origin main