Update GitHub workflows #136
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build binary release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- '*' | |
jobs: | |
linux_binary: | |
name: Build binary on Ubuntu 20.04 | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/checkout@v4 | |
with: | |
path: focus-stack | |
fetch-depth: "0" | |
- name: Install build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install libopencv-dev build-essential debhelper devscripts | |
- name: Build binary, .deb and appimage | |
run: | | |
cd focus-stack | |
make | |
make builddeb | |
make build/focus-stack.AppImage | |
- name: Upload deb | |
uses: actions/upload-artifact@v4 | |
with: | |
path: focus-stack/DEBUILD/*.deb | |
name: Focus-stack Ubuntu 20.04 package | |
- name: Upload ddeb | |
uses: actions/upload-artifact@v4 | |
with: | |
path: focus-stack/DEBUILD/*.ddeb | |
name: Focus-stack Ubuntu 20.04 debug symbols | |
- name: Upload appimage | |
uses: actions/upload-artifact@v4 | |
with: | |
path: focus-stack/build/focus-stack.AppImage | |
name: Focus-stack Linux x86_64 AppImage | |
mac_binary: | |
name: Build binary on Mac OS X 14 | |
runs-on: macos-14 | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/checkout@v4 | |
with: | |
path: focus-stack | |
fetch-depth: "0" | |
- name: Install build dependencies | |
run: | | |
brew install opencv pkg-config dylibbundler | |
- name: Build binary | |
run: | | |
cd focus-stack | |
make | |
sudo make distrib/focus-stack_MacOSX.zip | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
path: focus-stack/distrib/focus-stack_MacOSX.zip | |
name: Focus-stack Mac OS X application | |
windows_binary: | |
name: Build binary on Windows 2022 | |
runs-on: windows-2022 | |
env: | |
VCPKG_BUILD_TYPE: release | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/checkout@v4 | |
with: | |
path: focus-stack | |
fetch-depth: "0" | |
- name: Set vcpkg build type | |
shell: powershell | |
working-directory: C:\vcpkg\triplets | |
run: | | |
$PSDefaultParameterValues['Out-File:Encoding'] = 'utf8' | |
echo "set(VCPKG_BUILD_TYPE release)" | Tee-Object -FilePath x64-windows-static.cmake -Append | |
echo "set(VCPKG_BUILD_TYPE release)" | Tee-Object -FilePath x64-windows.cmake -Append | |
echo "set(VCPKG_BUILD_TYPE release)" | Tee-Object -FilePath x86-windows-static.cmake -Append | |
echo "set(VCPKG_BUILD_TYPE release)" | Tee-Object -FilePath x86-windows.cmake -Append | |
cat x64-windows-static.cmake | |
cat x64-windows.cmake | |
- name: Cache dependencies | |
id: cache-vcpkg-1 | |
uses: actions/cache@v4 | |
with: | |
path: | | |
C:\Users\runneradmin\AppData\Local\vcpkg\archives | |
C:\vcpkg\installed | |
key: vcpkg-win2022-cache | |
- name: Install OpenCV dependency | |
shell: cmd | |
run: | | |
vcpkg install opencv:x64-windows | |
- name: Build binary | |
shell: cmd | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
cd focus-stack | |
nmake -f Makefile.windows OPENCV_INC=C:\vcpkg\installed\x64-windows\include OPENCV_LIB=C:\vcpkg\installed\x64-windows\lib\opencv*.lib OPENCV_DLL=C:\vcpkg\installed\x64-windows\bin\*.dll | |
nmake -f Makefile.windows package | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: focus-stack/distrib/*.zip | |
name: Focus-stack Windows binary | |
- name: Upload debug symbols | |
uses: actions/upload-artifact@v4 | |
with: | |
path: focus-stack/build/*.pdb | |
name: Focus-stack Windows debug symbols | |
release: | |
needs: [linux_binary, mac_binary, windows_binary] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/checkout@v4 | |
with: | |
path: focus-stack | |
fetch-depth: "0" | |
- name: Download artifacts | |
run: | | |
mkdir -p focus-stack/distrib | |
cd focus-stack/distrib | |
gh run --repo ${GITHUB_REPOSITORY} download -n 'Focus-stack Mac OS X application' | |
gh run --repo ${GITHUB_REPOSITORY} download -n 'Focus-stack Ubuntu 20.04 package' | |
gh run --repo ${GITHUB_REPOSITORY} download -n 'Focus-stack Linux x86_64 AppImage' | |
gh run --repo ${GITHUB_REPOSITORY} download -n 'Focus-stack Windows binary' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: List artifacts | |
run: | | |
find focus-stack/distrib | |
- name: Upload to latest release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: github.ref == 'refs/heads/master' | |
run: | | |
cd focus-stack | |
git tag -d latest | |
git tag latest | |
git push origin --force latest | |
cd distrib | |
gh api repos/${GITHUB_REPOSITORY}/releases/tags/latest | jq -r '.assets[] | [.url] | @tsv' | xargs -n 1 gh api -X DELETE || true | |
gh release upload --repo ${GITHUB_REPOSITORY} --clobber latest * | |
- name: Upload to newly created release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
cd focus-stack/distrib | |
RELEASE=$(basename ${{github.ref}}) | |
gh release upload --repo ${GITHUB_REPOSITORY} $RELEASE * |