-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (70 loc) · 2.77 KB
/
build.yml
File metadata and controls
92 lines (70 loc) · 2.77 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
name: Build Binarys
on:
push:
paths:
- 'cpp/**'
- '.github/workflows/build.yml'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build_linux:
name: Build linux binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linux-binary
path: ${{github.workspace}}/build/cpp/libserialport.so
build_windows:
name: Build win64 binaries
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: windows-binary
path: ${{github.workspace}}\build\cpp\Release\serialport.dll
commit:
needs: [build_windows, build_linux]
name: Commit binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Download artifact
uses: actions/download-artifact@v3
with:
path: ${{github.workspace}}/tmp
- name: Create bin folder if it does not exist
run: mkdir -p ${{github.workspace}}/ts/bin
- name: Move and rename linux binary
run: mv ${{github.workspace}}/tmp/linux-binary/libserialport.so ${{github.workspace}}/ts/bin/linux.so
- name: Move and rename windows binary
run: mv ${{github.workspace}}/tmp/windows-binary/serialport.dll ${{github.workspace}}/ts/bin/windows.dll
- name: Configure Git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Commit binaries
run: |
git add ${{github.workspace}}/ts/bin/*
git diff-index --quiet HEAD || git commit -m "Commited compiled binaries"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.RELEASE_TOKEN }}
branch: ${{ github.ref }}