-
Notifications
You must be signed in to change notification settings - Fork 1
631 lines (601 loc) · 26.2 KB
/
mpv.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
name: MPV
run-name: "${{ format('{0} ({1})', github.workflow, inputs.compiler) }}"
on:
# schedule:
# - cron: '0 8 * * *'
workflow_dispatch:
inputs:
winbuild_repo:
required: true
default: 'dyphire/mpv-winbuild-cmake'
winbuild_ref:
required: true
default: 'patch'
build_target:
description: "Build target"
required: false
default: "all-64bit"
type: choice
options:
- 32bit
- 64bit
- 64bit-v3
- all-64bit
- all
compiler:
required: false
default: "clang"
type: choice
options:
- gcc
- clang
needclean:
description: 'Delete cache and completely rebuild erverything'
required: false
default: false
type: boolean
no_save_cache:
description: "Don't save caches after success build"
required: false
default: false
type: boolean
release:
description: "Publish a release"
required: false
default: true
type: boolean
command:
description: 'input command you want to run before build'
required: false
# Workflow level env does not work properly in all fields.
# https://github.com/actions/runner/issues/480
env:
winbuildrepo: 'dyphire/mpv-winbuild-cmake'
winbuildref: 'patch'
mpvowner: 'mpv-player'
mpvref: 'master'
jobs:
# https://github.com/actions/runner/issues/480#issuecomment-1055373623
params:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.script.outputs.sha }}
params: ${{ steps.env-vars.outputs.params }}
matrix: ${{ steps.script.outputs.matrix }}
steps:
- name: Set mpv_owner
run: |
if [[ "${{ inputs.winbuild_repo }}" == "${{ env.winbuildrepo }}" && "${{ inputs.winbuild_ref }}" == "${{ env.winbuildref }}" ]] ; then
echo "mpv_owner=${{ env.mpvowner }}" >> $GITHUB_ENV
else
echo "mpv_owner=mpv-player" >> $GITHUB_ENV
fi
- name: Set mpv_ref
run: |
if [[ "${{ inputs.winbuild_repo }}" == "${{ env.winbuildrepo }}" && "${{ inputs.winbuild_ref }}" == "${{ env.winbuildref }}" ]] ; then
echo "mpv_ref=${{ env.mpvref }}" >> $GITHUB_ENV
else
echo "mpv_ref=master" >> $GITHUB_ENV
fi
- id: script
uses: actions/github-script@v7
with:
script: |
const commit = await github.rest.repos.getCommit({
owner: '${{ env.mpv_owner }}',
repo: 'mpv',
ref: '${{ env.mpv_ref }}'
})
core.setOutput('sha', String(commit.data.sha))
let matrix = {};
let build_target = "${{ inputs.build_target }}"
switch ( build_target ) {
case "32bit":
matrix.bit = ["32"];
break;
case "64bit":
matrix.bit = ["64"];
break;
case "64bit-v3":
matrix.bit = ["64-v3"];
break;
case "all-64bit":
matrix.bit = ["64","64-v3"];
break;
case "all":
matrix.bit = ["32","64","64-v3"];
break;
default:
matrix.bit = ["64","64-v3"];
break;
}
core.setOutput("matrix",JSON.stringify(matrix));
- id: env-vars
name: Output environment variables
run: echo "params=$(echo $(jq -n 'env'))" >> $GITHUB_OUTPUT
build_mpv:
name: Build MPV
needs: params
runs-on: ubuntu-latest
container:
image: archlinux/archlinux:base-devel
continue-on-error: true
strategy:
matrix: ${{ fromJson(needs.params.outputs.matrix) }}
steps:
- name: Install Dependencies
run: |
sudo echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
sudo pacman -Syu --noconfirm
sudo pacman -S --noconfirm --needed git ninja cmake meson clang lld libc++ unzip ragel yasm nasm gperf rst2pdf lib32-gcc-libs lib32-glib2 python-cairo curl wget mimalloc ccache
mkdir -p /home/opt/7zip
wget -qO - https://7-zip.org/a/7z2405-linux-x64.tar.xz | tar -xJf - -C /home/opt/7zip 7zzs
sudo ln -s /home/opt/7zip/7zzs /usr/bin/7z
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global pull.rebase true
git config --global rebase.autoStash true
git config --global fetch.prune true
- uses: actions/checkout@v4
- name: Prepare
run: |
echo "sha=${{ needs.params.outputs.sha }}" >> $GITHUB_ENV
echo "winbuild_repo=${{ inputs.winbuild_repo }}" >> $GITHUB_ENV
echo "winbuild_ref=${{ inputs.winbuild_ref }}" >> $GITHUB_ENV
echo "mpv_owner=${{ fromJson(needs.params.outputs.params).mpv_owner }}" >> $GITHUB_ENV
echo "mpv_ref=${{ fromJson(needs.params.outputs.params).mpv_ref }}" >> $GITHUB_ENV
echo "short_time=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
echo "cache_suffix=$(date "+%Y-%m-%d")-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_ENV
- name: Checkout toolchain
uses: actions/checkout@v4
with:
repository: ${{ inputs.winbuild_repo }}
ref: ${{ inputs.winbuild_ref }}
path: mpv-winbuild-cmake
fetch-depth: 0
- name: Ccache
run: |
sed -i '/ccache_conf.in/d' mpv-winbuild-cmake/CMakeLists.txt
sed -i '/ccache/d' mpv-winbuild-cmake/exec.in
- name: Lookup Toolchain Cache
id: lookup_toolchain
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }}
key: toolchain-${{ inputs.compiler }}-build${{ matrix.bit }}-${{ env.cache_suffix }}
restore-keys: |
toolchain-${{ inputs.compiler }}-build${{ matrix.bit }}-
lookup-only: true
- name: Lookup Build Cache
id: lookup_build
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }}
key: ${{ inputs.compiler }}-build${{ matrix.bit }}-${{ env.cache_suffix }}
restore-keys: |
${{ inputs.compiler }}-build${{ matrix.bit }}-
lookup-only: true
- name: Generate cache key
id: generate_key
uses: actions/github-script@v7
with:
script: |
let toolchain_restore_key="${{ steps.lookup_toolchain.outputs.cache-matched-key }}";
let build_restore_key="${{ steps.lookup_build.outputs.cache-matched-key }}";
let build_save_key="${{ inputs.compiler }}-build${{ matrix.bit }}-${{ env.cache_suffix }}";
let key_suffix= "${{ env.cache_suffix }}"
let restore_suffix= ""; // if only want to match primaryKey, set a value which make restore-keys can't hit
// If toolchain cache exist, compare version of toolchain and build
if (toolchain_restore_key) {
const toolchain_version = toolchain_restore_key.split("-build${{ matrix.bit }}-").at(-1);
core.exportVariable( `toolchain_version`, toolchain_version );
build_save_key += `(${toolchain_version})`;
// If build cache version is not same as toolchain or needclean=true, don't restore build cache.
// Else, don't restore toolchain cache and use build cache.
if ( !build_restore_key.includes(toolchain_version) || ${{ inputs.needclean == true }} ) {
build_restore_key="";
key_suffix=toolchain_version; // only use same version cache as toolchain-version
restore_suffix="-only-use-primaryKey-"; // make restore-keys can't hit
} else {
toolchain_restore_key="";
}
}
core.exportVariable( `toolchain_restore_key`, toolchain_restore_key );
core.exportVariable( `build_restore_key`, build_restore_key );
core.exportVariable( `build_save_key`, build_save_key );
core.exportVariable( `key_suffix`, key_suffix );
core.exportVariable( `restore_suffix`, restore_suffix );
- name: Keep inital clang sysroot cache alive
if: ${{ inputs.compiler =='clang' && env.toolchain_version }}
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/clang_root
key: ${{ matrix.bit }}-clang_root-${{ env.toolchain_version }}
restore-keys: |
${{ matrix.bit }}-clang_root-${{ env.toolchain_version }}
lookup-only: true
- name: Keep llvm cache alive
if: ${{ inputs.compiler =='clang' }}
uses: actions/cache/[email protected]
with:
path: mpv-winbuild-cmake/clang_root
key: llvm-${{ env.toolchain_version }}
restore-keys: |
llvm-
lookup-only: true
- name: Restore clang sysroot cache
if: ${{ inputs.compiler =='clang' && inputs.no_save_cache != true }}
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/clang_root
key: ${{ matrix.bit }}-clang_root-${{ env.key_suffix }}
restore-keys: |
${{ matrix.bit }}-clang_root-${{ env.restore_suffix }}
- name: Restore Rust Cache
uses: actions/cache/[email protected]
id: cache_rust
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/install_rustup
key: rust-${{ env.key_suffix }}
restore-keys: |
rust-${{ env.restore_suffix }}
- name: Restore Source Cache
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/src_packages
key: source-${{ env.key_suffix }}
restore-keys: |
source-${{ env.restore_suffix }}
- name: Restore Toolchain Cache
if: ${{ env.toolchain_restore_key != '' }}
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }}
key: ${{ env.toolchain_restore_key }}
- name: Restore Build Cache
if: ${{ inputs.needclean != true && env.build_restore_key != '' }}
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }}
key: ${{ env.build_restore_key }}
- name: Set up ccache
uses: zhongfly/setup-ccache-action@dist
with:
update_packager_index: false
install_ccache: false
override_cache_key: ccache-build${{ matrix.bit }}-${{ inputs.compiler }}
ccache_options: |
cache_dir=$GITHUB_WORKSPACE/.ccache
max_size=500M
sloppiness=locale,time_macros
compiler_check=none
- name: Running custom command
if: ${{ inputs.command != '' }}
shell: bash
continue-on-error: true
run: |
cd mpv-winbuild-cmake
bit="${{ matrix.bit }}"
compiler="${{ inputs.compiler }}"
gitdir=$(pwd)
clang_root=$(pwd)/clang_root
buildroot=$(pwd)
srcdir=$(pwd)/src_packages
builddir=$buildroot/build$bit
if [ $bit == "32" ]; then
arch="i686"
elif [ $bit == "64" ]; then
arch="x86_64"
elif [ $bit == "64-v3" ]; then
arch="x86_64"
gcc_arch=-DGCC_ARCH=x86-64-v3
x86_64_level=-v3
fi
retry-tool() {
local RETRY_COUNTER=0
local MAX_RETRY=3
while [[ $RETRY_COUNTER -lt $MAX_RETRY ]]; do
$@ && break || sleep 2
RETRY_COUNTER=$(( $RETRY_COUNTER + 1 ))
echo "Retry $RETRY_COUNTER..."
done
if [[ $RETRY_COUNTER -ge $MAX_RETRY ]]; then
echo "Max retry count exceeded."
fi
}
set -x
${{ inputs.command }}
- name: Build
id: build
shell: bash
run: |
chmod +x build.sh
cd mpv-winbuild-cmake
if [[ "$(ls -A ../patch/*.patch)" ]]; then
for patch in ../patch/*.patch ; do
git am --3way "$patch" || git am --abort
done
fi
bash ../build.sh -t '${{ matrix.bit }}' -c '${{ inputs.compiler }}'
- name: Collect logs
if: ${{ always() }}
run: |
sudo 7z a logs.7z $(find mpv-winbuild-cmake/build${{ matrix.bit }} -type f -iname "*-*.log" -or -wholename "*/ffbuild/config.log")
- name: upload logs
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ matrix.bit }}_logs
path: logs.7z
- name: "Get artifacts' name and path"
id: get_files
uses: actions/github-script@v7
with:
script: |
const path = require('path');
const types = [ "mpv-dev", "mpv"];
let arch="";
switch ( "${{ matrix.bit }}" ) {
case "32":
arch = "i686";
break;
case "64":
arch = "x86_64";
break;
case "64-v3":
arch = "x86_64-v3";
break;
}
for (let type of types) {
const globber = await glob.create(`mpv-winbuild-cmake/release/${type}-${arch}-*.7z`);
const files = await globber.glob();
if ( files.length > 0 ) {
const file = files[0];
core.exportVariable( `${type}_name`, path.basename(file) );
core.exportVariable( `${type}_path`, file );
}
}
let { stdout: ffmpeg_hash } = await exec.getExecOutput("git -C mpv-winbuild-cmake/src_packages/ffmpeg rev-parse --short HEAD");
ffmpeg_hash = ffmpeg_hash.trim();
const ffmpeg_name = `ffmpeg-${arch}-git-${ffmpeg_hash}`;
core.exportVariable( 'ffmpeg_name', ffmpeg_name );
const globber = await glob.create(`./mpv-winbuild-cmake/build${{ matrix.bit }}/**/ffmpeg.exe`);
const ffmpeg_path = (await globber.glob())[0]
await exec.exec(`7z a -m0=lzma2 -mx=9 -ms=on mpv-winbuild-cmake/release/${ffmpeg_name}.7z ${ffmpeg_path}`)
- name: Upload mpv-dev
uses: actions/upload-artifact@v4
if: ${{ env.mpv-dev_name && env.mpv-dev_path }}
with:
name: ${{ env.mpv-dev_name }}
path: ${{ env.mpv-dev_path }}
- name: Upload mpv
uses: actions/upload-artifact@v4
if: ${{ env.mpv_name && env.mpv_path }}
with:
name: ${{ env.mpv_name }}
path: ${{ env.mpv_path }}
- name: Upload ffmpeg
uses: actions/upload-artifact@v4
if: ${{ env.ffmpeg_name }}
with:
name: ${{ env.ffmpeg_name }}
path: mpv-winbuild-cmake/release/${{ env.ffmpeg_name }}.7z
- name: Save clang sysroot cache
if: ${{ inputs.compiler =='clang' }}
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/clang_root
key: ${{ matrix.bit }}-clang_root-${{ env.cache_suffix }}
- name: Save Sources Cache
if: ${{ inputs.no_save_cache != true }}
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/src_packages
key: source-${{ env.cache_suffix }}
- name: Save Rust Cache
if: ${{ inputs.no_save_cache != true }}
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/install_rustup
key: rust-${{ env.cache_suffix }}
- name: Save Build Cache
if: ${{ inputs.no_save_cache != true }}
uses: actions/cache/[email protected]
with:
path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }}
key: ${{ env.build_save_key }}
- name: "Job summary"
uses: actions/github-script@v7
continue-on-error: true
if: ${{ always() }}
with:
script: |
const path = require('path');
const { readdirSync,existsSync } = require('fs');
const myExec = async (command, args = null) => await exec.getExecOutput(command,args,{silent: true}).then(result => result.stdout.trim()).catch(err => '');
const upstreamDir = path.resolve("mpv-winbuild-cmake");
const workdir = path.resolve(upstreamDir,"src_packages");
const isGitSync = dirname => existsSync(path.join(workdir, dirname, '.git'));
const getGithubUrl = (hash,remote) => remote.replace(/\.git$/,"") + `/commit/${hash}`;
const getGitlabUrl = (hash,remote) => remote.replace(/\.git$/,"") + `/-/commit/${hash}`;
const getBitbucketUrl = (hash,remote) => remote.replace(/\.git$/,"") + `/commits/${hash}`;
const getGoogleSourceUrl = (hash,remote) => remote + `/+/${hash}`;
const gethGitVideolanUrl = (hash,remote) => remote.replace(/\/git\//,"/?p=") + `;a=commit;h=${hash}`;
const getCgitUrl = (hash,remote) => remote + `/commit/?id=${hash}`;
function getCommitUrl(hash,remote) {
let url = "";
switch (true) {
case /github\.com/.test(remote):
url = getGithubUrl(hash,remote);
break;
case /(gitlab\.com|code\.videolan\.org|gitlab\.gnome\.org)/.test(remote):
url = getGitlabUrl(hash,remote);
break;
case /bitbucket\.org/.test(remote):
url = getBitbucketUrl(hash,remote);
break;
case /googlesource\.com/.test(remote):
url = getGoogleSourceUrl(hash,remote);
break;
case /git\.videolan\.org/.test(remote):
url = gethGitVideolanUrl(hash,remote);
break;
case /git\.libssh\.org/.test(remote):
url = getCgitUrl(hash,remote);
break;
default:
url = remote;
break;
}
return url;
}
async function repo_info(dir){
let local_hash = await myExec(`git -C ${dir} rev-parse --short=7 HEAD`);
let remote_branch = await myExec(`git -C ${dir} rev-parse --abbrev-ref HEAD@{upstream}`);
let remote_hash = await myExec(`git -C ${dir} rev-parse ${remote_branch}`);
let status = await myExec(`git -C ${dir} status -sb`).then(s => s.split("\n",1)[0].replace(/^## */,""));
let remote = await myExec(`git -C ${dir} config --get remote.origin.url`);
return [local_hash, remote_hash, status, remote]
}
async function generateGitInfoTable(targetDir){
const dirs = readdirSync(targetDir, { withFileTypes: true })
.filter(dirent => dirent.isDirectory() && isGitSync(dirent.name) )
.map(dirent => path.join(targetDir, dirent.name));
let info_table = [[{data: 'Package', header: true}, {data: 'Local commit', header: true}, {data: 'Status', header: true}, {data: 'Remote commit', header: true}]];
for (let dir of dirs) {
[local_hash, remote_hash, status, remote] = await repo_info(dir)
let url = getCommitUrl(remote_hash, remote);
let package_name = path.basename(dir);
info_table.push([package_name, local_hash, status, `<a href="${url}">${remote_hash.slice(0,7)}</a>`]);
}
return info_table;
}
await core.summary.clear();
let packages_table = await generateGitInfoTable(workdir);
packages_table = core.summary.addTable(packages_table).stringify();
await core.summary.clear();
[upstream_local_hash, upstream_remote_hash, upstream_status, upstream_remote] = await repo_info(upstreamDir)
const upstream_url = getCommitUrl(upstream_remote_hash, upstream_remote);
core.summary
.addRaw(`mpv-winbuild-cmake: ${upstream_status} (remote:<a href="${upstream_url}">${upstream_remote_hash.slice(0,7)}</a>)`,true)
.addRaw(`Compiler: ${{ inputs.compiler }}`,true);
await core.summary.addDetails('Packages Version',packages_table).write();
publish_release:
name: Publish release
needs: [build_mpv,params]
if: ${{ inputs.release == true }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: '{mpv,ffmpeg}*'
merge-multiple: true
- name: "Check artifacts"
uses: actions/github-script@v7
with:
script: |
const globber = await glob.create(`artifacts/mpv*.7z`);
const files = await globber.glob();
if ( files.length == 0 ) {
core.setFailed("Artifact does not exist!");
}
- name: Get current time & Params
run: |
echo "sha=${{ needs.params.outputs.sha }}" >> $GITHUB_ENV
echo "winbuild_repo=${{ inputs.winbuild_repo }}" >> $GITHUB_ENV
echo "winbuild_ref=${{ inputs.winbuild_ref }}" >> $GITHUB_ENV
echo "mpv_owner=${{ fromJson(needs.params.outputs.params).mpv_owner }}" >> $GITHUB_ENV
echo "mpv_ref=${{ fromJson(needs.params.outputs.params).mpv_ref }}" >> $GITHUB_ENV
echo "long_time=$(date "+%Y-%m-%d %H:%M")" >> $GITHUB_ENV
echo "short_time=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
echo "tag_name=$(date "+%Y-%m-%d")-$(head -c 7 <<< "${{ needs.params.outputs.sha }}")" >> $GITHUB_ENV
- name: Commit version & remove existing tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.tag_name }}
shell: bash
run: |
git fetch --tags
git checkout version || git checkout -b version origin/version || ( git checkout --orphan version && git rm -rf . )
echo -e "${tag_name}" > version
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add version
git diff-index --quiet HEAD || ( git commit -m "${tag_name}" && git push origin version )
if [ $(git tag -l "${tag_name}") ] ;then
gh release delete "${tag_name}" || true
git push --delete origin "${tag_name}" || true
git tag -d "${tag_name}" || true
fi
git checkout master
- name: "Generate release note"
id: note
uses: actions/github-script@v7
with:
script: |
const sha = `${{ env.sha }}`;
const winbuild_repo = `${{ env.winbuild_repo }}`;
const winbuild_ref = `${{ env.winbuild_ref }}`;
const winbuildrepo = `${{ env.winbuildrepo }}`;
const winbuildref = `${{ env.winbuildref }}`;
let note = "";
if ( winbuild_repo == winbuildrepo && winbuild_ref == winbuildref ) {
note+=`**MPV Git commit**: https://github.com/mpv-player/mpv/commit/${sha}\n`;
note+="**Changed**\n";
note+="- LuaSocket is built and included, so [simple-mpv-webui](https://github.com/open-dynaMIX/simple-mpv-webui) can be used out of the box\n\n";
note+="**Fixes and Minor Enhancements**\n";
note+="- davs2: enable 10bit\n";
note+="- libass: parse script properties even if missing '[Script Info]'\n";
note+="- FFmpeg: check for double BOM in UTF-16 subtitle files\n";
note+="- FFmpeg: Parsing ASS subtitle files with missing [Script Info] in the first line\n";
note+="- FFmpeg: only handle negative durations for non-ASS subs\n";
note+="- FFmpeg: handle long TrueHD input_timing gaps\n";
note+="- FFmpeg: potential TrueHD FFmpeg Passthrough Fix\n\n";
} else {
note+=`**MPV Git commit**: https://github.com/mpv-player/mpv/commit/${sha}\n`;
}
note+="**Build Time**: ${{ env.long_time }}\n";
note+="**Compiler**: ${{ inputs.compiler }}\n";
note+="**Build Details**: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}\n";
core.setOutput("note", note);
- name: Create release for mpv_own
uses: ncipollo/release-action@v1
if: ${{ ( inputs.winbuild_repo == env.winbuildrepo && inputs.winbuild_ref == env.winbuildref ) }}
with:
artifacts: "artifacts/mpv*.7z,artifacts/ffmpeg*.7z"
commit: version
name: "MPV_OWN ${{ env.long_time }}"
body: "${{ steps.note.outputs.note }}"
tag: "mpv_own-${{ env.short_time }}"
allowUpdates: true
artifactErrorsFailBuild: true
removeArtifacts: true
prerelease: false
makeLatest: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release for mpv-player/mpv
uses: ncipollo/release-action@v1
if: ${{ inputs.winbuild_repo != env.winbuildrepo || inputs.winbuild_ref != env.winbuildref }}
with:
artifacts: "artifacts/mpv*.7z,artifacts/ffmpeg*.7z"
commit: version
name: "MPV ${{ env.long_time }}"
body: "${{ steps.note.outputs.note }}"
tag: "mpv-${{ env.short_time }}"
allowUpdates: true
artifactErrorsFailBuild: true
removeArtifacts: true
prerelease: false
makeLatest: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Prune old releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
git checkout master
bash prunetags.sh