Skip to content

Commit d535074

Browse files
committed
tiny fix
1 parent 32b8caa commit d535074

File tree

1 file changed

+52
-41
lines changed

1 file changed

+52
-41
lines changed

.github/workflows/release.yml

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,47 @@ on:
55
tags:
66
- "v*"
77
- "[0-9]+.*"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
13+
env:
14+
CARGO_TERM_COLOR: always
815

916
jobs:
1017
build:
18+
name: Build ${{ matrix.target }}
19+
runs-on: ${{ matrix.os }}
1120
strategy:
21+
fail-fast: false
1222
matrix:
1323
include:
1424
- target: x86_64-apple-darwin
15-
os: macos-13
25+
os: macos-15
1626
- target: aarch64-apple-darwin
17-
os: macos-14
18-
19-
runs-on: ${{ matrix.os }}
27+
os: macos-15
2028

2129
steps:
2230
- uses: actions/checkout@v4
2331

24-
- name: Install Rust
32+
- name: Install Rust toolchain
2533
uses: dtolnay/rust-toolchain@stable
2634
with:
2735
targets: ${{ matrix.target }}
2836

37+
- name: Cache cargo
38+
uses: Swatinem/rust-cache@v2
39+
with:
40+
key: ${{ matrix.target }}
41+
2942
- name: Build
3043
run: cargo build --release --target ${{ matrix.target }}
3144

3245
- name: Package
3346
run: |
3447
cd target/${{ matrix.target }}/release
35-
tar -czvf ../../../rip-${{ matrix.target }}.tar.gz rip
48+
tar czf ../../../rip-${{ matrix.target }}.tar.gz rip
3649
cd ../../..
3750
3851
- name: Upload artifact
@@ -42,51 +55,48 @@ jobs:
4255
path: rip-${{ matrix.target }}.tar.gz
4356

4457
release:
58+
name: Release
4559
needs: build
4660
runs-on: ubuntu-latest
61+
4762
steps:
4863
- uses: actions/checkout@v4
4964

50-
- name: Download artifacts
65+
- name: Download all artifacts
5166
uses: actions/download-artifact@v4
52-
53-
- name: Create Release
54-
uses: softprops/action-gh-release@v1
5567
with:
56-
files: |
57-
rip-x86_64-apple-darwin/rip-x86_64-apple-darwin.tar.gz
58-
rip-aarch64-apple-darwin/rip-aarch64-apple-darwin.tar.gz
68+
path: artifacts
69+
merge-multiple: true
5970

60-
update-homebrew:
61-
needs: release
62-
runs-on: ubuntu-latest
63-
steps:
64-
- name: Download artifacts
65-
uses: actions/download-artifact@v4
71+
- name: List artifacts
72+
run: ls -la artifacts/
6673

67-
- name: Get SHA256
68-
id: sha
74+
- name: Create GitHub Release
75+
uses: softprops/action-gh-release@v2
76+
with:
77+
files: artifacts/*
78+
generate_release_notes: true
79+
80+
- name: Compute checksums
6981
run: |
70-
echo "arm=$(shasum -a 256 rip-aarch64-apple-darwin/rip-aarch64-apple-darwin.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
71-
echo "intel=$(shasum -a 256 rip-x86_64-apple-darwin/rip-x86_64-apple-darwin.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
82+
cd artifacts
83+
echo "ARM_SHA=$(sha256sum rip-aarch64-apple-darwin.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV
84+
echo "INTEL_SHA=$(sha256sum rip-x86_64-apple-darwin.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV
7285
73-
- name: Checkout homebrew-tap
86+
- name: Checkout Homebrew tap
7487
uses: actions/checkout@v4
7588
with:
7689
repository: cesarferreira/homebrew-tap
7790
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
78-
path: homebrew-tap
91+
path: tap
7992

80-
- name: Update formula and push
81-
env:
82-
ARM_SHA: ${{ steps.sha.outputs.arm }}
83-
INTEL_SHA: ${{ steps.sha.outputs.intel }}
93+
- name: Update formula
8494
run: |
85-
# Handle both v0.4.0 and 0.4.0 tag formats
86-
TAG=${GITHUB_REF#refs/tags/}
95+
TAG=${GITHUB_REF_NAME}
8796
VERSION=${TAG#v}
88-
89-
cat > homebrew-tap/Formula/rip.rb << EOF
97+
FORMULA=tap/Formula/rip.rb
98+
99+
cat > $FORMULA << EOF
90100
class Rip < Formula
91101
desc "Fuzzy find and kill processes from your terminal"
92102
homepage "https://github.com/cesarferreira/rip"
@@ -113,13 +123,14 @@ jobs:
113123
end
114124
end
115125
EOF
116-
117-
# Remove leading spaces from heredoc
118-
sed -i'' -e 's/^ //' homebrew-tap/Formula/rip.rb
119-
120-
cd homebrew-tap
121-
git config user.name "GitHub Actions"
122-
git config user.email "actions@github.com"
126+
127+
- name: Commit and push tap
128+
run: |
129+
cd tap
130+
git config user.name "github-actions[bot]"
131+
git config user.email "github-actions[bot]@users.noreply.github.com"
123132
git add Formula/rip.rb
124-
git commit -m "Update rip to ${VERSION}"
133+
git commit -m "rip ${VERSION}"
125134
git push
135+
env:
136+
VERSION: ${{ github.ref_name }}

0 commit comments

Comments
 (0)