Change build workflow to run on tags push #1
Workflow file for this run
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 plugins | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
image: ghcr.io/gillesvink/nukedockerbuild | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
nuke_version: ["13.0", "13.1", "13.2", "14.0", "14.1", "15.0"] | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download OpenImageDenoise | |
run: | | |
wget https://github.com/OpenImageDenoise/oidn/releases/download/v2.1.0/oidn-2.1.0.x86_64.linux.tar.gz | |
tar -xzvf oidn-2.1.0.x86_64.linux.tar.gz -C /opt/ | |
- name: Pull image | |
run: docker pull ${{ env.image }}:${{ matrix.nuke_version }}-linux-slim-latest | |
- name: Run build | |
run: docker run --rm -v "${{ github.workspace }}:/nuke_build_directory" ${{ env.image }}:${{ matrix.nuke_version }}-linux-slim-latest bash -c "cmake3 . -B build && cmake3 --build build" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: linux-${{ matrix.nuke_version }} | |
path: ${{ github.workspace }}/build/lib | |
build-macos: | |
runs-on: macos-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
nuke_version: ["13.0", "13.1", "13.2", "14.0", "14.1", "15.0"] | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker | |
run: | | |
brew install docker open-image-denoise | |
colima start --cpu 2 --memory 10 --disk 10 | |
- name: Pull image | |
run: docker pull ${{ env.image }}:${{ matrix.nuke_version }}-macos-latest | |
- name: Run build | |
run: docker run --rm -v "${{ github.workspace }}:/nuke_build_directory" ${{ env.image }}:${{ matrix.nuke_version }}-macos-latest bash -c "cmake . -B build && cmake --build build" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: macos-${{ matrix.nuke_version }} | |
path: ${{ github.workspace }}/build/lib | |
build-macos-arm: | |
runs-on: macos-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
nuke_version: ["15.0"] | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker | |
run: | | |
brew install docker open-image-denoise | |
colima start --cpu 2 --memory 10 --disk 10 | |
- name: Pull image | |
run: docker pull ${{ env.image }}:${{ matrix.nuke_version }}-macos-arm-latest | |
- name: Run build | |
run: docker run --rm -v "${{ github.workspace }}:/nuke_build_directory" ${{ env.image }}:${{ matrix.nuke_version }}-macos-arm-latest bash -c "cmake . -B build && cmake --build build" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: macos_arm-${{ matrix.nuke_version }} | |
path: ${{ github.workspace }}/build/lib | |
build-windows: | |
runs-on: windows-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
nuke_version: ["13.0", "13.1", "13.2", "14.0", "14.1", "15.0"] | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download OpenImageDenoise | |
run: | | |
Invoke-WebRequest -Uri "https://github.com/OpenImageDenoise/oidn/releases/download/v2.1.0/oidn-2.1.0.x64.windows.zip" -OutFile "C:\oidn-2.1.0.x64.windows.zip" | |
Expand-Archive "C:\oidn-2.1.0.x64.windows.zip" -DestinationPath "C:\" -Verbose | |
- name: Pull image | |
run: docker pull ${{ env.image }}:${{ matrix.nuke_version }}-windows-latest | |
- name: Run build | |
run: docker run --rm -v "${{ github.workspace }}:C:\nuke_build_directory" ${{ env.image }}:${{ matrix.nuke_version }}-windows-latest powershell -Command "cmake . -DCMAKE_GENERATOR_PLATFORM=x64 -B build ; cmake --build build --config Release" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: windows-${{ matrix.nuke_version }} | |
path: ${{ github.workspace }}/build/lib/Release | |
create-release: | |
runs-on: ubuntu-latest | |
needs: [build-linux, build-windows, build-macos, build-macos-arm] | |
permissions: write-all | |
if: ${{ always() && !cancelled() && needs.build-linux.result == 'success'}} | |
env: | |
release_file_name: ${{ github.event.repository.name }}_${{ github.ref_name }} | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: ${{ github.workspace }} | |
- name: Collect files and put them in release folder structure | |
run: | | |
mkdir /tmp/${{ github.event.repository.name }} | |
for artifact in ${{ github.workspace }}/*; do | |
if [ -d "$artifact" ]; then | |
basename=$(basename -- $artifact) | |
os=$(echo "$basename" | cut -d'-' -f1) | |
version=$(echo "$basename" | cut -d'-' -f2) | |
export OS="$os" | |
export VERSION="$version" | |
destination_dir="/tmp/${{ github.event.repository.name }}/${VERSION}/${OS}" | |
mkdir -p "${destination_dir}" | |
echo "${destination_dir}" | |
for file in "$artifact"/*.dll "$artifact"/*.so "$artifact"/*.dylib; do | |
if [ -f "${file}" ]; then | |
cp "${file}" "${destination_dir}/" | |
echo "Copied ${file} to ${destination_dir}/" | |
fi | |
done | |
fi | |
done | |
- name: Prepare zip | |
run: | | |
cd /tmp | |
zip -r /tmp/${{ env.release_file_name }}.zip ${{ github.event.repository.name }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: release_candidate | |
path: /tmp/${{ env.release_file_name }}.zip | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: /tmp/${{ env.release_file_name }}.zip |