11env :
22 MSYS2_PATH_TYPE : inherit
33 SDK_VER : 10.0.22621.0
4- TAG_NAME : ${{ inputs.tag_name ||github.ref_name }}
4+ REF_NAME : ${{ inputs.ref_name ||github.ref_name }}
55
66name : Build
7- run-name : Build ${{inputs.tag_name ||github.ref_name}}
7+ run-name : Build ${{inputs.ref_name ||github.ref_name}}
88
99on :
1010 push :
1111 tags : " *"
12+ workflow_call :
13+ inputs :
14+ ref_name :
15+ description : " Tag"
16+ required : true
17+ type : string
1218 workflow_dispatch :
1319 inputs :
14- tag_name :
20+ ref_name :
1521 description : " Tag"
1622 required : true
23+ type : string
1724
1825jobs :
26+ prepare :
27+ uses : ./.github/workflows/cache.yml
28+ with :
29+ ref_name : ${{inputs.ref_name||github.ref_name}}
1930 build :
31+ needs : prepare
2032 strategy :
2133 matrix :
2234 arch : [x86, amd64, arm, arm64]
@@ -26,18 +38,34 @@ jobs:
2638 runs-on : windows-2022
2739 env :
2840 # amd64_arm,amd64_arm64,x86,amd64
29- name : ffmpeg-${{ inputs.tag_name ||github.ref_name }}-${{matrix.license}}-${{matrix.arch}}-${{matrix.type}}
41+ name : ffmpeg-${{ inputs.ref_name ||github.ref_name }}-${{matrix.license}}-${{matrix.arch}}-${{matrix.type}}
3042 target : ${{contains(matrix.arch,'arm')&&format('amd64_{0}',matrix.arch)||matrix.arch}}
3143 steps :
32- - name : Find MSVC
44+ - uses : actions/checkout@v4
45+ with :
46+ ref : ${{env.REF_NAME}}
47+ # submodules: recursive
48+
49+ - name : Setup Env
3350 shell : bash
34- id : msvc
51+ id : setup
3552 run : |
3653 echo "installationPath=$(vswhere -all -legacy -property installationPath)">>$GITHUB_OUTPUT
37- - uses : actions/checkout@v4
54+ # KEY=$(git ls-tree -r ${{env.REF_NAME}}|grep ^160000|sort -d|md5sum|cut -d' ' -f1)
55+ # echo "cache-key=$KEY" >>$GITHUB_OUTPUT
56+
57+ - name : Restore cached submodules
58+ id : cache-submodules-restore
59+ uses : actions/cache@v4
3860 with :
39- ref : ${{env.TAG_NAME}}
40- submodules : recursive
61+ path : .git/modules
62+ # key: ${{ runner.os }}-${{steps.setup.outputs.cache-key}}-submodules
63+ key : ${{ needs.prepare.outputs.cache-key }}
64+
65+ - name : Pull submodules
66+ shell : bash
67+ run : |
68+ git submodule update --init --recursive --depth 1
4169
4270 - uses : msys2/setup-msys2@v2
4371 with :
5886 - name : Build
5987 shell : cmd
6088 run : |
61- CALL "${{steps.msvc .outputs.installationPath}}\VC\Auxiliary\Build\vcvarsall.bat" ${{env.target}} ${{env.SDK_VER}}
89+ CALL "${{steps.setup .outputs.installationPath}}\VC\Auxiliary\Build\vcvarsall.bat" ${{env.target}} ${{env.SDK_VER}}
6290 msys2 -c "./build.sh ${{matrix.arch}} ${{matrix.type}} ${{matrix.license}}"
6391
6492 - name : Debug log
@@ -79,13 +107,14 @@ jobs:
79107 cd ${CWD}
80108 sha1sum ${{env.name}}.zip >${{env.name}}.sha1
81109 ./build-changelog.sh > changelog
110+
82111 - name : Release
83112 if : ${{startsWith(github.ref, 'refs/tags/')}}
84113 uses : softprops/action-gh-release@v2
85114 with :
86- tag_name : ${{env.TAG_NAME }}
115+ ref_name : ${{env.REF_NAME }}
87116 body_path : changelog
88- prerelease : ${{contains(env.TAG_NAME ,'dev')}}
117+ prerelease : ${{contains(env.REF_NAME ,'dev')}}
89118 files : |
90119 ${{env.name}}.zip
91120 ${{env.name}}.sha1
0 commit comments