-
-
Notifications
You must be signed in to change notification settings - Fork 22
141 lines (119 loc) · 6.17 KB
/
build-on-pull-request.yaml
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
name: Build FFmpeg on pull request
on:
pull_request_target:
paths:
- ffmpeg-source
- ffmpeg-windows-build-helpers
- dependencies.sh
- .github/workflows/build-on-push.yaml
- .github/workflows/build-on-pull-request.yaml
jobs:
build:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]' || github.actor == 'AnimMouse'
strategy:
matrix:
os: [win64, win32]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
persist-credentials: false
- name: Install dependencies
run: ./dependencies.sh
- name: Get current FFmpeg git commit SHA & date
id: git-sha-date
working-directory: ffmpeg-source
run: |
echo git-sha=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
echo git-date=$(git log -1 --format=%ci) >> $GITHUB_OUTPUT
- name: Get current ffmpeg-windows-build-helpers git commit SHA
id: helper-git-sha
working-directory: ffmpeg-windows-build-helpers
run: echo git-sha=$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
- name: Move ffmpeg-windows-build-helpers
run: mv -v ./ffmpeg-windows-build-helpers/* ./
- name: Get current date & time before build
id: date-time-before
run: echo date-time=$(date +'%Y-%m-%d %H:%M') >> $GITHUB_OUTPUT
- name: Compile FFmpeg using ffmpeg-windows-build-helpers
run: ./cross_compile_ffmpeg.sh --ffmpeg-source-dir=$GITHUB_WORKSPACE/ffmpeg-source --gcc-cpu-count=$(nproc) --disable-nonfree=n --sandbox-ok=y --compiler-flavors=${{ matrix.os }}
- name: Get current date & time after build
id: date-time-after
run: |
echo date-time=$(date +'%Y-%m-%d %H:%M') >> $GITHUB_OUTPUT
echo date-time-tag=$(date +'%Y-%m-%d-%H-%M') >> $GITHUB_OUTPUT
- name: Upload FFmpeg ${{ matrix.os }} nonfree
uses: actions/upload-artifact@v3
with:
name: ffmpeg-${{ steps.git-sha-date.outputs.git-sha }}-${{ steps.helper-git-sha.outputs.git-sha }}-${{ matrix.os }}-nonfree
path: ffmpeg-source/ffmpeg.exe
- name: Upload FFprobe ${{ matrix.os }} nonfree
uses: actions/upload-artifact@v3
with:
name: ffprobe-${{ steps.git-sha-date.outputs.git-sha }}-${{ steps.helper-git-sha.outputs.git-sha }}-${{ matrix.os }}-nonfree
path: ffmpeg-source/ffprobe.exe
- name: Upload FFplay ${{ matrix.os }} nonfree
uses: actions/upload-artifact@v3
with:
name: ffplay-${{ steps.git-sha-date.outputs.git-sha }}-${{ steps.helper-git-sha.outputs.git-sha }}-${{ matrix.os }}-nonfree
path: ffmpeg-source/ffplay.exe
outputs:
date-time-before: ${{ steps.date-time-before.outputs.date-time }}
date-time-after: ${{ steps.date-time-after.outputs.date-time }}
date-time-after-tag: ${{ steps.date-time-after.outputs.date-time-tag }}
git-sha: ${{ steps.git-sha-date.outputs.git-sha }}
git-date: ${{ steps.git-sha-date.outputs.git-date }}
helper-git-sha: ${{ steps.helper-git-sha.outputs.git-sha }}
archive:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
os: [win64, win32]
steps:
- name: Download FFmpeg ${{ matrix.os }} nonfree
uses: actions/download-artifact@v3
with:
name: ffmpeg-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree
- name: Download FFprobe ${{ matrix.os }} nonfree
uses: actions/download-artifact@v3
with:
name: ffprobe-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree
- name: Download FFplay ${{ matrix.os }} nonfree
uses: actions/download-artifact@v3
with:
name: ffplay-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree
- name: 7-Zip FFmpeg ${{ matrix.os }} nonfree
run: 7z a ffmpeg-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree.7z ffmpeg.exe ffprobe.exe ffplay.exe -mx9
- name: Upload FFmpeg archive ${{ matrix.os }} nonfree
uses: actions/upload-artifact@v3
with:
name: ffmpeg-archive-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree
path: ffmpeg-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-${{ matrix.os }}-nonfree.7z
release:
needs: [build, archive]
runs-on: ubuntu-latest
steps:
- name: Download FFmpeg archive win64
uses: actions/download-artifact@v3
with:
name: ffmpeg-archive-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-win64-nonfree
- name: Download FFmpeg archive win32
uses: actions/download-artifact@v3
with:
name: ffmpeg-archive-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-win32-nonfree
- name: Release
run: |
gh release create "a-${{ needs.build.outputs.date-time-after-tag }}" \
"ffmpeg-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-win64-nonfree.7z" \
"ffmpeg-${{ needs.build.outputs.git-sha }}-${{ needs.build.outputs.helper-git-sha }}-win32-nonfree.7z" \
-n "FFmpeg nonfree git-${{ needs.build.outputs.git-sha }} in ${{ needs.build.outputs.git-date }} built on ${{ needs.build.outputs.date-time-after }} started at ${{ needs.build.outputs.date-time-before }}
Using ffmpeg-windows-build-helpers git-${{ needs.build.outputs.helper-git-sha }}" \
-p -t "Auto ${{ needs.build.outputs.date-time-after }} ${{ needs.build.outputs.git-sha }}"
env:
GITHUB_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}