Skip to content

Commit 100349f

Browse files
committed
When publishing a new release, build the project and add it to the release
The workflow "Release Windows artifacts" will be runned when we create a new github release. It will automatically create the .7z file containing the x86 + x64 build and add it to the release.
1 parent d72723d commit 100349f

3 files changed

Lines changed: 124 additions & 64 deletions

File tree

.github/workflows/ci-meson.yml

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -71,67 +71,3 @@ jobs:
7171

7272
- name: Run tests
7373
run: meson test -C builddir --verbose
74-
75-
build-win:
76-
strategy:
77-
fail-fast: false
78-
matrix:
79-
arch: [x86, x64]
80-
81-
name: "Test Windows MSVC (${{ matrix.arch }})"
82-
runs-on: windows-latest
83-
84-
steps:
85-
- name: Checkout code
86-
uses: actions/checkout@v6
87-
88-
- name: Install Meson
89-
run: pip install meson
90-
91-
- name: Install ffmpeg
92-
run: vcpkg install ffmpeg[avcodec,avdevice,avfilter,avformat,swresample,swscale,zlib,bzip2,core,dav1d,gpl,version3,lzma,openssl,xml2]:${{ matrix.arch }}-windows-static
93-
94-
- name: Set VCPKG_PATH environment variable
95-
run: |
96-
$vcpkg_path = Split-Path (Get-Command vcpkg).Source -Parent
97-
echo "VCPKG_PATH=$vcpkg_path" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
98-
99-
- name: Install pkgconf
100-
uses: msys2/setup-msys2@v2
101-
id: msys2
102-
with:
103-
msystem: MINGW64
104-
install: mingw-w64-x86_64-pkgconf
105-
106-
- name: Setup MSVC Developer Command Prompt
107-
uses: ilammy/msvc-dev-cmd@v1
108-
with:
109-
arch: ${{ matrix.arch }}
110-
111-
- name: Configure with Meson
112-
env:
113-
PKG_CONFIG: "${{ steps.msys2.outputs.msys2-location }}\\mingw64\\bin\\pkg-config.EXE"
114-
run: >
115-
meson setup builddir
116-
--buildtype=release
117-
--vsenv
118-
-Dtest=enabled
119-
-Davisynth=enabled
120-
--pkg-config-path="$env:VCPKG_PATH\installed\${{ matrix.arch }}-windows-static\lib\pkgconfig"
121-
-Db_vscrt=mt
122-
# Use "-Db_vscrt=mt" to avoid this warning: LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
123-
124-
- name: Build
125-
run: meson compile -C builddir --verbose
126-
127-
- name: Run tests
128-
run: meson test -C builddir --verbose
129-
130-
- name: Install
131-
run: meson install -C builddir --destdir install
132-
133-
- name: Upload Build
134-
uses: actions/upload-artifact@v6
135-
with:
136-
name: ffms2_windows_${{ matrix.arch }}
137-
path: builddir/install
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: On Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
call-build-win:
9+
uses: ./.github/workflows/ci-windows.yml
10+
11+
release-win:
12+
name: Release Windows artifacts
13+
runs-on: windows-latest
14+
needs: call-build-win
15+
permissions:
16+
contents: write
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v6
21+
22+
- name: Download wheel artifact
23+
uses: actions/download-artifact@v7
24+
25+
- name: Set RELEASE_TAG environment variable
26+
run: |
27+
$release_tag = "ffms2-${{ github.event.release.tag_name }}-msvc"
28+
echo "RELEASE_TAG=$release_tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
29+
30+
- name: Create package
31+
run: |
32+
mkdir $env:RELEASE_TAG
33+
cd $env:RELEASE_TAG
34+
Copy-Item -Path "..\ffms2_windows_x64\share\doc\ffms2" -Destination "doc" -Recurse
35+
Copy-Item -Path "..\ffms2_windows_x64\include" -Destination "include" -Recurse
36+
Copy-Item -Path "..\etc\*" -Destination "."
37+
mkdir x86
38+
Copy-Item -Path "..\ffms2_windows_x86\bin\ffms2.dll" -Destination "x86"
39+
Copy-Item -Path "..\ffms2_windows_x86\bin\ffmsindex.exe" -Destination "x86"
40+
Copy-Item -Path "..\ffms2_windows_x86\lib\ffms2.lib" -Destination "x86"
41+
mkdir x64
42+
Copy-Item -Path "..\ffms2_windows_x64\bin\ffms2.dll" -Destination "x64"
43+
Copy-Item -Path "..\ffms2_windows_x64\bin\ffmsindex.exe" -Destination "x64"
44+
Copy-Item -Path "..\ffms2_windows_x64\lib\ffms2.lib" -Destination "x64"
45+
cd ..
46+
7z a "$env:RELEASE_TAG.7z" $env:RELEASE_TAG
47+
48+
- name: Upload artifact to GitHub Release
49+
env:
50+
GITHUB_TOKEN: ${{ github.token }}
51+
run: gh release upload '${{ github.ref_name }}' "$env:RELEASE_TAG.7z"

.github/workflows/ci-windows.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build on Windows
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_call:
9+
10+
jobs:
11+
build-win:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
arch: [x86, x64]
16+
17+
name: "Test Windows MSVC (${{ matrix.arch }})"
18+
runs-on: windows-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v6
23+
24+
- name: Install Meson
25+
run: pip install meson
26+
27+
- name: Install ffmpeg
28+
run: vcpkg install ffmpeg[avcodec,avdevice,avfilter,avformat,swresample,swscale,zlib,bzip2,core,dav1d,gpl,version3,lzma,openssl,xml2]:${{ matrix.arch }}-windows-static
29+
30+
- name: Set VCPKG_PATH environment variable
31+
run: |
32+
$vcpkg_path = Split-Path (Get-Command vcpkg).Source -Parent
33+
echo "VCPKG_PATH=$vcpkg_path" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
34+
35+
- name: Install pkgconf
36+
uses: msys2/setup-msys2@v2
37+
id: msys2
38+
with:
39+
msystem: MINGW64
40+
install: mingw-w64-x86_64-pkgconf
41+
42+
- name: Setup MSVC Developer Command Prompt
43+
uses: ilammy/msvc-dev-cmd@v1
44+
with:
45+
arch: ${{ matrix.arch }}
46+
47+
- name: Configure with Meson
48+
env:
49+
PKG_CONFIG: "${{ steps.msys2.outputs.msys2-location }}\\mingw64\\bin\\pkg-config.EXE"
50+
run: >
51+
meson setup builddir
52+
--buildtype=release
53+
--vsenv
54+
-Dtest=enabled
55+
-Davisynth=enabled
56+
--pkg-config-path="$env:VCPKG_PATH\installed\${{ matrix.arch }}-windows-static\lib\pkgconfig"
57+
-Db_vscrt=mt
58+
# Use "-Db_vscrt=mt" to avoid this warning: LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
59+
60+
- name: Build
61+
run: meson compile -C builddir --verbose
62+
63+
- name: Run tests
64+
run: meson test -C builddir --verbose
65+
66+
- name: Install
67+
run: meson install -C builddir --destdir install
68+
69+
- name: Upload Build
70+
uses: actions/upload-artifact@v6
71+
with:
72+
name: ffms2_windows_${{ matrix.arch }}
73+
path: builddir/install

0 commit comments

Comments
 (0)