115 lines
3.4 KiB
YAML
115 lines
3.4 KiB
YAML
name: Build Windows Installer
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install NSIS and build tools
|
|
run: |
|
|
if command -v sudo >/dev/null 2>&1; then
|
|
sudo apt-get update
|
|
sudo apt-get install -y nsis wget curl tar unzip zip ca-certificates
|
|
else
|
|
apt-get update
|
|
apt-get install -y nsis wget curl tar unzip zip ca-certificates
|
|
fi
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: Build & test frontend
|
|
working-directory: frontend
|
|
run: |
|
|
npm install
|
|
npm test
|
|
npm run build
|
|
|
|
- name: Run Go unit tests
|
|
run: go test ./...
|
|
|
|
- name: Determine version
|
|
id: ver
|
|
run: |
|
|
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
|
|
VER="${GITHUB_REF_NAME#v}"
|
|
else
|
|
VER="2.0.0-ci.${GITHUB_RUN_NUMBER}"
|
|
fi
|
|
echo "version=${VER}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Embed Windows icon and manifest (.syso)
|
|
run: |
|
|
go run github.com/akavel/rsrc@v0.10.2 \
|
|
-arch amd64 \
|
|
-ico build/windows/icon.ico \
|
|
-manifest build/windows/app.manifest \
|
|
-o rsrc_windows_amd64.syso
|
|
|
|
- name: Cross-compile Windows binary (convert.exe)
|
|
env:
|
|
CGO_ENABLED: "0"
|
|
GOOS: windows
|
|
GOARCH: amd64
|
|
run: |
|
|
mkdir -p dist/bin
|
|
go build -tags desktop,production \
|
|
-ldflags="-H windowsgui -s -w -X main.Version=${{ steps.ver.outputs.version }}" \
|
|
-o dist/convert.exe .
|
|
|
|
- name: Cache static FFmpeg binaries
|
|
id: cache-ffmpeg
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: dist/bin
|
|
key: ffmpeg-win64-master-static
|
|
|
|
- name: Download static FFmpeg & FFprobe for Windows
|
|
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
|
|
run: |
|
|
mkdir -p dist/bin
|
|
wget -q -O ffmpeg.zip "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip"
|
|
unzip -j -q ffmpeg.zip "*/bin/ffmpeg.exe" "*/bin/ffprobe.exe" -d dist/bin/
|
|
rm -f ffmpeg.zip
|
|
|
|
- name: Package Portable ZIP
|
|
run: |
|
|
cd dist
|
|
zip -r "ConvertGUI-Portable-${{ steps.ver.outputs.version }}-win64.zip" convert.exe bin/
|
|
|
|
- name: Build Windows NSIS Installer
|
|
run: |
|
|
makensis -DVERSION="${{ steps.ver.outputs.version }}" installer/installer.nsi
|
|
|
|
- name: Upload Build Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ConvertGUI-Windows-${{ steps.ver.outputs.version }}
|
|
path: |
|
|
dist/ConvertGUI-Setup-${{ steps.ver.outputs.version }}.exe
|
|
dist/ConvertGUI-Portable-${{ steps.ver.outputs.version }}-win64.zip
|
|
|
|
- name: Publish Gitea Release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
files: |
|
|
dist/ConvertGUI-Setup-${{ steps.ver.outputs.version }}.exe
|
|
dist/ConvertGUI-Portable-${{ steps.ver.outputs.version }}-win64.zip
|
|
name: Release ${{ github.ref_name }}
|