Skip to content

Commit 45072e6

Browse files
author
Chris
committed
update workflows
1 parent 80d6ffc commit 45072e6

File tree

1 file changed

+31
-28
lines changed

1 file changed

+31
-28
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,17 @@ on:
66
- "v*"
77

88
permissions:
9-
contents: write # create GH release + upload assets
9+
contents: write
1010

1111
jobs:
1212
build:
1313
strategy:
1414
matrix:
1515
include:
16-
- target: x86_64-unknown-linux-gnu
17-
os: ubuntu-latest
18-
use_cross: true
19-
- target: aarch64-unknown-linux-gnu
20-
os: ubuntu-latest
21-
use_cross: true
2216
- target: x86_64-apple-darwin
2317
os: macos-latest
24-
use_cross: false
2518
- target: aarch64-apple-darwin
2619
os: macos-latest
27-
use_cross: false
2820

2921
runs-on: ${{ matrix.os }}
3022

@@ -35,37 +27,25 @@ jobs:
3527
with:
3628
targets: ${{ matrix.target }}
3729

38-
- uses: taiki-e/install-action@v2
39-
if: matrix.use_cross
40-
with:
41-
tool: cross
42-
43-
- name: Build (cross)
44-
if: matrix.use_cross
45-
run: cross build --release --target ${{ matrix.target }}
46-
47-
- name: Build (native)
48-
if: ${{ !matrix.use_cross }}
30+
- name: Build
4931
run: cargo build --release --target ${{ matrix.target }}
5032

5133
- name: Package
5234
shell: bash
5335
run: |
5436
set -eux
55-
VERSION="${GITHUB_REF_NAME}" # e.g. v0.1.1
37+
VERSION="${GITHUB_REF_NAME}"
5638
TARGET="${{ matrix.target }}"
57-
OUTDIR="dist"
58-
mkdir -p "$OUTDIR"
39+
mkdir -p dist
5940
6041
BIN="target/$TARGET/release/canine"
61-
6242
PKG="canine_${VERSION}_${TARGET}"
6343
mkdir -p "$PKG"
6444
cp "$BIN" "$PKG/"
6545
66-
tar -czf "$OUTDIR/$PKG.tar.gz" "$PKG"
46+
tar -czf "dist/$PKG.tar.gz" "$PKG"
6747
68-
- name: Upload artifacts to workflow run
48+
- name: Upload artifacts
6949
uses: actions/upload-artifact@v4
7050
with:
7151
name: dist-${{ matrix.target }}
@@ -74,19 +54,26 @@ jobs:
7454
release:
7555
runs-on: ubuntu-latest
7656
needs: build
57+
outputs:
58+
sha256_intel: ${{ steps.checksums.outputs.sha256_intel }}
59+
sha256_arm: ${{ steps.checksums.outputs.sha256_arm }}
7760
steps:
7861
- name: Download all artifacts
7962
uses: actions/download-artifact@v4
8063
with:
8164
path: dist
8265

83-
- name: Flatten dist
66+
- name: Flatten and checksum
67+
id: checksums
8468
shell: bash
8569
run: |
8670
set -eux
8771
mkdir -p out
8872
find dist -name "*.tar.gz" -exec cp {} out/ \;
89-
(cd out && shasum -a 256 *.tar.gz > SHA256SUMS)
73+
cd out
74+
sha256sum *.tar.gz > SHA256SUMS
75+
echo "sha256_intel=$(grep x86_64-apple-darwin SHA256SUMS | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
76+
echo "sha256_arm=$(grep aarch64-apple-darwin SHA256SUMS | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
9077
9178
- name: Create GitHub Release
9279
uses: softprops/action-gh-release@v2
@@ -95,3 +82,19 @@ jobs:
9582
out/*.tar.gz
9683
out/SHA256SUMS
9784
85+
update-homebrew:
86+
runs-on: ubuntu-latest
87+
needs: release
88+
steps:
89+
- name: Update Homebrew formula
90+
uses: peter-evans/repository-dispatch@v3
91+
with:
92+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
93+
repository: CanineHQ/homebrew-canine
94+
event-type: update-formula
95+
client-payload: |
96+
{
97+
"version": "${{ github.ref_name }}",
98+
"sha256_intel": "${{ needs.release.outputs.sha256_intel }}",
99+
"sha256_arm": "${{ needs.release.outputs.sha256_arm }}"
100+
}

0 commit comments

Comments
 (0)