-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (119 loc) · 3.86 KB
/
build.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
144
145
---
name: "build"
"on":
push:
branches:
- "main"
tags:
- "*"
pull_request:
branches:
- "main"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: "${{ github.ref != 'refs/heads/main' }}"
env:
CURL_VERSION: "curl-8_7_1"
CURL_BASEURL: "https://github.com/curl/curl/archive/refs/tags"
CURL_TARGZ_SHA256: "0e46c856f517602c347bb5fe5b73174f8ee798bc87f1a97235c95761f75fcc28"
CURL_ZIP_SHA256: "1522999600630964ADC3130EADA47DC0BE2A71908A36944B7AA78AAD2B1006B7"
jobs:
BuildMac:
runs-on: "macos-14"
strategy:
matrix:
config:
- "Release"
- "Debug"
defaults:
run:
shell: "bash"
steps:
- name: "Get version"
run: |
if [[ $GITHUB_REF =~ ^refs/tags/ ]]
then version="${GITHUB_REF#refs/tags/}"
else version=main
fi
printf "version=%s" "$version" > "$GITHUB_OUTPUT"
id: "get-version"
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Download and extract Curl"
run: |
curl -fsSLO "$CURL_BASEURL/curl-$CURL_VERSION.tar.gz"
echo "$CURL_TARGZ_SHA256 curl-$CURL_VERSION.tar.gz" | shasum -c
tar -xf "curl-$CURL_VERSION.tar.gz"
- name: "Run build-macos.sh"
run: './build-macos.sh ${{ matrix.config }} ${{ steps.get-version.outputs.version }} "curl-$CURL_VERSION"'
- name: "Upload artifacts"
uses: "actions/upload-artifact@v4"
with:
name: "libcurl-macos-${{ matrix.config }}"
path: "release/*.tar.gz"
BuildWindows:
runs-on: "windows-2022"
strategy:
matrix:
config:
- "Release"
- "Debug"
steps:
- name: "Get version"
shell: bash
run: |
if [[ $GITHUB_REF =~ ^refs/tags/ ]]
then version="${GITHUB_REF#refs/tags/}"
else version=main
fi
printf "version=%s" "$version" > "$GITHUB_OUTPUT"
id: "get-version"
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Download and extract Curl"
run: |
Invoke-WebRequest -Uri "$Env:CURL_BASEURL/$Env:CURL_VERSION.zip" -OutFile "curl-$Env:CURL_VERSION.zip"
$hash = Get-FileHash "curl-$Env:CURL_VERSION.zip" -Algorithm SHA256
if ( $hash.Hash -ne "$Env:CURL_ZIP_SHA256" ) {
exit 1
}
Expand-Archive -Path "curl-$Env:CURL_VERSION.zip" -DestinationPath "."
- name: "Run Build-Windows.ps1"
run: './Build-Windows.ps1 -Configuration "${{ matrix.config }}" -Version "${{ steps.get-version.outputs.version }}" -CurlDirectory "curl-$Env:CURL_VERSION"'
- name: "Upload artifacts"
uses: "actions/upload-artifact@v4"
with:
name: "opencv-windows-${{ matrix.config }}"
path: "release/*.zip"
Release:
runs-on: "ubuntu-22.04"
if: "github.event_name == 'push' && contains(github.ref, 'refs/tags/')"
needs:
- "BuildMac"
- "BuildWindows"
permissions:
contents: "write"
defaults:
run:
shell: "bash"
steps:
- name: "Get version"
shell: "bash"
run: |
if [[ $GITHUB_REF =~ ^refs/tags/ ]]
then version="${GITHUB_REF#refs/tags/}"
else version=main
fi
printf "version=%s" "$version" > "$GITHUB_OUTPUT"
id: "get-version"
- name: "Download build artifacts"
uses: "actions/download-artifact@v4"
- name: "Create Release"
uses: "softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b"
with:
draft: true
tag_name: "${{ steps.get-version.outputs.version }}"
name: "${{ steps.get-version.outputs.version }}"
files: |
${{ github.workspace }}/**/*.tar.gz
${{ github.workspace }}/**/*.zip