-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.5 KB
/
prebuild.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
name: Pre-build binaries
on:
push:
branches: ["**"]
pull_request:
branches: [main]
permissions:
contents: write
jobs:
prebuild:
strategy:
matrix:
runner:
- ubuntu-latest
- macos-12
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: actions/setup-go@v4
with:
go-version: "1.19.13"
- name: Install
run: npm install --ignore-scripts
- name: Build
run: |
if [[ "$RUNNER_OS" == "macOS" ]]; then
npm run build:arm64 && npm run build:x64
else
npm run build
npm test
fi
- name: Commit pre-built binary
if: (github.event_name == 'pull_request' || (github.event_name == 'push' && contains(github.event.head_commit.message, 'CI=pre-build')))
run: |
if [ -n "$(git status --porcelain -- prebuilds)" ]; then
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add prebuilds src/keyring.h
git commit -m "build: add pre-build binary for $(uname -s | tr '[:upper:]' '[:lower:]')"
git pull --rebase
git push
fi