-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (80 loc) · 2.45 KB
/
Copy pathbuild.yml
File metadata and controls
91 lines (80 loc) · 2.45 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
name: build
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 0.2.7)'
required: false
default: ''
repository_dispatch:
types: [build-ruby]
env:
NIM_VERSION: '2.2.0'
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
max-parallel: 1
matrix:
include:
- runner: macos-13
arch: x86_64-darwin
ext: bundle
- runner: macos-latest
arch: arm64-darwin
ext: bundle
- runner: ubuntu-22.04
arch: x86_64-linux
ext: so
steps:
- name: "Checkout tim-ruby"
uses: actions/checkout@v4
with:
path: tim-ruby
- name: "Checkout tim (main repo)"
uses: actions/checkout@v4
with:
repository: tim-engine/tim
token: ${{ secrets.TIM_EXT_PAT }}
path: tim-main
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: ${{ env.NIM_VERSION }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- run: sudo apt-get update && sudo apt-get install -y ruby ruby-dev
if: runner.os == 'Linux'
- name: "Install Clue"
run: nimble install -y clue@#head
working-directory: tim-main
- name: "Build Ruby extension"
run: nimble ruby
working-directory: tim-main
- name: "Copy binary"
run: |
mkdir -p tim-ruby/lib
cp tim-main/build/Tim.bundle "tim-ruby/lib/tim_engine-${{ matrix.arch }}.${{ matrix.ext }}"
- name: "Update gemspec version"
run: |
VERSION="${{ github.event.inputs.version || github.event.client_payload.version }}"
if [ -n "$VERSION" ]; then
cd tim-ruby
sed -i "s/s.version.*=.*\".*\"/s.version = \"${VERSION#v}\"/" tim.gemspec
fi
- name: "Commit and push"
run: |
cd tim-ruby
git config user.name "OpenPeeps Bot"
git config user.email "bot@openpeeps.dev"
VERSION="${{ github.event.inputs.version || github.event.client_payload.version }}"
TAG=""
if [ -n "$VERSION" ]; then
TAG="v${VERSION#v}"
fi
git add -A
git commit -m "Tim Engine ${TAG:-update} (${{ matrix.arch }})" || echo "Nothing to commit"
if [ -n "$TAG" ]; then
git tag -f "$TAG"
fi
git push origin main --tags