-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (92 loc) · 3.54 KB
/
release.yml
File metadata and controls
109 lines (92 loc) · 3.54 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
name: release
on:
push:
tags:
- 'v*'
jobs:
job-matrix:
name: ${{ matrix.os }}; release:${{ matrix.release-build }}; ${{ matrix.cross-target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-latest
release-build: true
- os: ubuntu-latest
cross-target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
cross-target: aarch64-unknown-linux-gnu
release-build: true
- os: macos-latest
- os: macos-latest
release-build: true
- os: macos-latest
cross-target: aarch64-apple-darwin
- os: macos-latest
cross-target: aarch64-apple-darwin
release-build: true
steps:
- uses: actions/checkout@v2
- name: Set outputs
id: set-outputs
run: |
if [[ "${{ matrix.cross-target }}" ]]; then
echo "::set-output name=build-target::${{ matrix.cross-target }}"
echo "::set-output name=target-option::--target=${{ matrix.cross-target }}"
elif [[ ${{ matrix.os }} == "macos-latest" ]]; then
echo "::set-output name=build-target::x86_64-apple-darwin"
echo "::set-output name=target-option::"
elif [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
echo "::set-output name=build-target::x86_64-unknown-linux-gnu"
echo "::set-output name=target-option::"
else
echo "Unknown OS: ${{ matrix.os }}"
exit 1
fi
if [[ "${{ matrix.release-build }}" ]]; then
echo "::set-output name=release-build-option::--release"
echo "::set-output name=build-type::release"
else
echo "::set-output name=release-build-option::"
echo "::set-output name=build-type::debug"
fi
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: llvm-tools-preview
override: true
- name: Straight build
if: ${{ ! matrix.cross-target }}
run: |
cargo build ${{ steps.set-outputs.outputs.release-build-option }}
- name: Install cross-build toolchain
if: ${{ matrix.cross-target }}
run: |
rustup target add ${{ matrix.cross-target }}
- name: Cross build
if: ${{ matrix.cross-target }}
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: ${{ steps.set-outputs.outputs.release-build-option }} ${{ steps.set-outputs.outputs.target-option }}
- name: create artifact
run: |
artifact_dir=springql_client-${{ steps.set-outputs.outputs.build-target }}-${{ steps.set-outputs.outputs.build-type }}
target_dir=target/${{ matrix.cross-target }}/${{ steps.set-outputs.outputs.build-type }}
mkdir ${artifact_dir}
cp springql.h ${artifact_dir}/
mv ${target_dir}/libspringql_client.{so,dylib} ${artifact_dir}/ || :
zip -r ${artifact_dir}.zip ${artifact_dir}
- name: Upload Files to a GitHub Release
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: springql_client-${{ steps.set-outputs.outputs.build-target }}-${{ steps.set-outputs.outputs.build-type }}.zip
tag: ${{ github.ref }}
overwrite: true
prerelease: false