-
Notifications
You must be signed in to change notification settings - Fork 1
169 lines (144 loc) · 4.96 KB
/
package.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
---
name: "Package"
on:
push:
paths-ignore:
- "*.md"
- ".gitignore"
- "doc/**"
env:
BUILD_TYPE: Release
jobs:
tarpkg:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create version.txt
run: git describe --tags --match 'v*' >version.txt
- name: Create tarball
run: |
NAME=nb-dashcam-tools-$(git describe --tags --match 'v*' --abbrev=0 | cut -c2-)
tar -C "${{github.workspace}}" -czf "${{runner.temp}}/$NAME.tgz" \
--exclude-vcs --transform "s,^\\.,$NAME," .
echo "$NAME.tgz" >"${{runner.temp}}/filename.txt"
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: tarball
path: |
${{runner.temp}}/nb-dashcam-tools-*.tgz
${{runner.temp}}/filename.txt
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && (!env.ACT)
with:
files: "${{runner.temp}}/nb-dashcam-tools-*.tgz"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
winpkg:
runs-on: windows-2019
needs: tarpkg
env:
qtver: "6.5.2"
steps:
- name: Setup MSVC command prompt
uses: ilammy/msvc-dev-cmd@v1
- name: Download tarball
id: fetch
uses: actions/download-artifact@v3
with:
name: tarball
path: ${{runner.temp}}
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{env.qtver}}
setup-python: false
dir: "${{runner.temp}}/Qt"
cache: true
- name: Extract Archive
shell: cmd
run: |
set /p FILE=<${{runner.temp}}\filename.txt
"%SystemRoot%\System32\tar.exe" -C "${{github.workspace}}" -xf "${{runner.temp}}\%FILE%" --strip-components 1
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWIN_INSTALL_FFMPEG=ON -DWIN_CREATE_SETUP=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install ${{github.workspace}}/build --prefix ${{github.workspace}}/deploy --config ${{env.BUILD_TYPE}}
- name: Upload package
if: ${{!env.ACT}}
uses: actions/upload-artifact@v3
with:
name: winpkg
path: ${{github.workspace}}/nb-dashcam-tools-setup.exe
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && (!env.ACT)
with:
files: ${{github.workspace}}/nb-dashcam-tools-setup.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
rpmpkg:
runs-on: ubuntu-latest
needs: tarpkg
strategy:
matrix:
tag: [38]
env:
DOCKER_BUILDKIT: '1'
steps:
- name: Download tarball
id: fetch
uses: actions/download-artifact@v3
with:
name: tarball
path: ${{runner.temp}}
- name: Extract Archive
run: |
tar -C "${{github.workspace}}" \
-xf "${{runner.temp}}/$(<${{runner.temp}}/filename.txt)" \
--strip-components=1
- name: Cache Docker Registry
id: cache-docker
uses: actions/cache@v3
with:
path: "${{runner.temp}}/registry"
key: docker-registry-${{hashFiles('.github/docker/**')}}-${{secrets.cache_version}}
- name: Start Docker Registry
run: |
docker run -d -p 5000:5000 --restart=always --name registry \
-v "${{runner.temp}}/registry:/var/lib/registry" registry:2
npx wait-on tcp:5000
- name: Build Docker Image
run: |
docker build -t fedora-rpm-build:${{matrix.tag}} \
--build-arg tag=${{matrix.tag}} \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from "localhost:5000/fedora-rpm-build:${{matrix.tag}}" \
"${{github.workspace}}/.github/docker/rpmpkg"
- name: Push Docker Image
if: steps.cache-docker.outputs.cache-hit != 'true'
run: |
docker tag fedora-rpm-build:${{matrix.tag}} localhost:5000/fedora-rpm-build:${{matrix.tag}}
docker push localhost:5000/fedora-rpm-build:${{matrix.tag}}
- name: Create RPM
run: docker run --rm -v "${{runner.temp}}:/mnt" fedora-rpm-build:${{matrix.tag}}
- name: Upload package
if: ${{!env.ACT}}
uses: actions/upload-artifact@v3
with:
name: rpmpkg-${{matrix.tag}}
path: "${{runner.temp}}/nb-dashcam-tools-*.rpm"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && (!env.ACT)
with:
files: "${{runner.temp}}/nb-dashcam-tools-*.rpm"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}