-
Notifications
You must be signed in to change notification settings - Fork 16
89 lines (77 loc) · 2.27 KB
/
build-and-release.yml
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
name: Build and Release
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
#- os: ubuntu-latest
# goos: linux
# goarch: arm64
#- os: macos-latest
# goos: darwin
# goarch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o otto8
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: otto8-${{ matrix.goos }}-${{ matrix.goarch }}
path: otto8
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/**
update-tap:
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout tap repository
uses: actions/checkout@v4
with:
repository: otto8-ai/homebrew-tap
token: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate SHA256 checksum
id: checksum
run: |
LINUX_SHA256=$(sha256sum ./artifacts/otto8-linux-amd64 | awk '{ print $1 }')
MACOS_SHA256=$(sha256sum ./artifacts/otto8-darwin-amd64 | awk '{ print $1 }')
echo "LINUX_SHA256=$LINUX_SHA256" >> $GITHUB_ENV
echo "MACOS_SHA256=$MACOS_SHA256" >> $GITHUB_ENV
- name: Update Formula
run: |
cp Formula/otto8.rb.tmpl Formula/otto8.rb
sed -i "s/__LINUX_SHA256__/$LINUX_SHA256/g" Formula/otto8.rb
sed -i "s/__MACOS_SHA256__/$MACOS_SHA256/g" Formula/otto8.rb
sed -i "s/__VERSION__/${{ github.run_number }}/g" Formula/otto8.rb
- name: Commit and Push changes
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .
git commit -m "Update otto8 formula to new version"
git push