-
-
Notifications
You must be signed in to change notification settings - Fork 5
143 lines (131 loc) · 5.32 KB
/
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Release
on:
push:
# Enable when testing release infrastructure on a branch.
#branches:
# - master
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
create-release:
runs-on: ubuntu-latest
# Set to force version number, e.g., when no tag exists.
#env:
#PRODUCT_VERSION: TEST-0.0.0
outputs:
version: ${{ env.PRODUCT_VERSION }}
upload_url: ${{ steps.release.outputs.upload_url }}
steps:
- name: Get the release version from the tag
if: env.PRODUCT_VERSION == ''
run: |
echo "PRODUCT_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Create GitHub release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.PRODUCT_VERSION }}
release_name: ${{ env.PRODUCT_VERSION }}
build-artifact:
needs: ["create-release"]
strategy:
matrix:
rust:
- stable
version:
- opencv: 4.5.2
brew: "@4"
features: opencv-4
os:
- build: linux
image: ubuntu-18.04
family: linux
target: x86_64-unknown-linux-musl
- build: macos
image: macos-10.15
family: osx
target: x86_64-apple-darwin
- build: win-msvc
image: windows-2019
family: windows
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os.image }}
env:
OS_FAMILY: ${{ matrix.os.family }}
RUST_TOOLCHAIN: ${{ matrix.rust }}
OPENCV_VERSION: ${{ matrix.version.opencv }}
CHOCO_OPENCV_VERSION: ${{ matrix.version.opencv }}
BREW_OPENCV_VERSION: ${{ matrix.version.brew }}
CARGO_FEATURES: ${{ matrix.version.features }}
steps:
- uses: actions/checkout@v2
- name: Cache OpenCV dependencies
uses: actions/cache@v1
with:
path: ~/build
key: ${{ runner.os }}-${{ matrix.version.opencv }}-build
- name: Install OpenCV dependencies
run: ci/install.sh
shell: bash
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
default: true
- name: Caches Rust
uses: Swatinem/rust-cache@v1
- name: Cache Webview Build
id: cache-webview
uses: actions/cache@v1
with:
path: ./webview/dist
key: ${{ hashFiles('./webview/**/*') }}-webview-build
- name: Install Node.js
if: steps.cache-webview.outputs.cache-hit != 'true'
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Install Webview Packages
if: steps.cache-webview.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
working-directory: webview
- name: Build Webview
if: steps.cache-webview.outputs.cache-hit != 'true'
run: yarn build
working-directory: webview
- name: Build
run: |
source ./ci/setup-env.sh
cargo build --release
shell: bash
- name: Build archive
shell: bash
run: |
staging="build-${{ matrix.os.build }}-${{ needs.create-release.outputs.version }}"
mkdir -p "$staging"
cp {README.md,LICENSE.md} "$staging/"
if [ "${{ matrix.os.family }}" = "windows" ]; then
cp "target/release/slideo.exe" "$staging/"
cp "C:\tools\opencv\build\x64\vc15\bin\opencv_world452.dll" "$staging/"
cp "C:\tools\opencv\build\x64\vc15\bin\opencv_videoio_ffmpeg452_64.dll" "$staging/"
cp "C:\tools\opencv\LICENSE_FFMPEG.txt" "$staging/"
cp "C:\tools\opencv\LICENSE.txt" "$staging/LICENSE_OPENCV.txt"
7z x ./dependencies/windows/poppler.7z -o$staging/poppler
7z a "$staging.zip" "$staging"
echo "ASSET=$staging.zip" >> $GITHUB_ENV
else
cp "target/release/slideo" "$staging/"
tar czf "$staging.tar.gz" "$staging"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
- name: Upload release archive
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
asset_content_type: application/octet-stream