-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (97 loc) · 3.78 KB
/
release.yml
File metadata and controls
114 lines (97 loc) · 3.78 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
name: Release
on:
push:
branches: [main]
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
patch: ${{ steps.version.outputs.patch }}
steps:
- uses: actions/checkout@v4
- name: Calculate version
id: version
run: |
PATCH="${{ github.run_number }}+$(git rev-parse --short HEAD)"
VERSION=$(make QUIET=1 version PATCH="$PATCH")
echo "patch=$PATCH" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
build:
needs: version
strategy:
matrix:
include:
- os: macos-latest # Apple Silicon runner
name: darwin-arm64
- os: macos-latest # Intel runner
name: darwin-x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: make PATCH="${{ needs.version.outputs.patch }}" QUIET=1
- name: Package
run: |
tar -czvf git-interactive-${{ matrix.name }}-v${{ needs.version.outputs.version }}.tar.gz -C dist/bin .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: git-interactive-${{ matrix.name }}
path: git-interactive-*.tar.gz
release:
needs: [version, build]
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
arm64_sha: ${{ steps.sha.outputs.arm64 }}
x86_64_sha: ${{ steps.sha.outputs.x86_64 }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: ls -la artifacts/
- name: Calculate SHA256
id: sha
run: |
ARM64_SHA=$(shasum -a 256 artifacts/*darwin-arm64*.tar.gz | cut -d' ' -f1)
X86_64_SHA=$(shasum -a 256 artifacts/*darwin-x86_64*.tar.gz | cut -d' ' -f1)
echo "arm64=$ARM64_SHA" >> $GITHUB_OUTPUT
echo "x86_64=$X86_64_SHA" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.version.outputs.version }}
name: v${{ needs.version.outputs.version }}
files: artifacts/*.tar.gz
generate_release_notes: true
update-homebrew:
needs: [version, release]
runs-on: ubuntu-latest
steps:
- name: Trigger Homebrew tap update
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
PAYLOAD: |
{
"formula": "git-interactive",
"template_url": "https://raw.githubusercontent.com/earlye/git-interactive/v${{ needs.version.outputs.version }}/homebrew/git-interactive.rb.template",
"version": "${{ needs.version.outputs.version }}",
"arm64_url": "https://github.com/earlye/git-interactive/releases/download/v${{ needs.version.outputs.version }}/git-interactive-darwin-arm64-v${{ needs.version.outputs.version }}.tar.gz",
"arm64_sha": "${{ needs.release.outputs.arm64_sha }}",
"x86_64_url": "https://github.com/earlye/git-interactive/releases/download/v${{ needs.version.outputs.version }}/git-interactive-darwin-x86_64-v${{ needs.version.outputs.version }}.tar.gz",
"x86_64_sha": "${{ needs.release.outputs.x86_64_sha }}"
}
run: |
set -x # let's see what we're sending
jq -Mc -n \
--arg event_type "update-formula" \
--argjson client_payload "$PAYLOAD" \
'{event_type: $event_type, client_payload: $client_payload}' \
| gh api repos/earlye/homebrew-tap/dispatches --input -