Skip to content

Update release build script #42

Update release build script

Update release build script #42

name: Draft New Release with Distributables
on:
workflow_dispatch:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
create_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
windows:
needs: create_release
runs-on: windows-latest
env:
EMULSION_VERSION: ${{ needs.create_release.outputs.version }}
INSTALLER_NAME: ${{ format('Emulsion-Windows-{0}.exe', needs.create_release.outputs.version) }}
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Print installer name
run: |
Write-Host $Env:INSTALLER_NAME
- name: Install NSIS
run: |
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
scoop bucket add extras
scoop install nsis
- name: Print NSIS version
run: makensis -VERSION
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch Prerequisites
working-directory: ./distribution/windows/prerequisites
run: (New-Object System.Net.WebClient).DownloadFile('https://aka.ms/vs/16/release/vc_redist.x64.exe', 'vc_redist.x64.exe')
- name: Install avif build dependencies (Windows)
run: |
choco install pkgconfiglite
vcpkg integrate install
echo "set(VCPKG_BUILD_TYPE release)" >> $env:VCPKG_INSTALLATION_ROOT\triplets\x64-windows.cmake
vcpkg install --triplet=x64-windows
echo "vcpkg install folder: $(((Get-Command vcpkg.exe | select Source -First 1).source | Get-Item).Directory.FullName)"
$PKG_CONFIG_PATH = "$((Resolve-Path ".").Path)/vcpkg_installed/x64-windows/lib/pkgconfig"
$PKG_CONFIG_PATH = $PKG_CONFIG_PATH.replace("\", "/")
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $env:GITHUB_ENV
curl -LO "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.2/LLVM-15.0.2-win64.exe"
./LLVM-15.0.2-win64.exe /S
echo "LIBCLANG_PATH is: $LIBCLANG_PATH"
$LIBCLANG_PATH = (resolve-path "$env:ProgramFiles/LLVM/bin").Path
$LIBCLANG_PATH = $LIBCLANG_PATH.replace("\", "/")
echo "------- CLANG BIN CONTENTS ----------"
dir $LIBCLANG_PATH
echo "LIBCLANG_PATH is: $LIBCLANG_PATH"
echo "LIBCLANG_PATH=$LIBCLANG_PATH" >> $env:GITHUB_ENV
- name: Build executable
run: |
echo "LIBCLANG_PATH is: $LIBCLANG_PATH"
echo "env:LIBCLANG_PATH is: $env:LIBCLANG_PATH"
$LIBCLANG_PATH = $env:LIBCLANG_PATH
echo "------- CLANG BIN CONTENTS ----------"
dir $LIBCLANG_PATH
cargo build --release --features=networking,avif
- name: Copy executable to distributable folder
working-directory: ./distribution/windows/
shell: cmd
run: |
mkdir program
copy /y ..\..\target\release\emulsion.exe program\emulsion.exe
- name: Create installer
working-directory: ./distribution/windows/
run: |
makensis /DVERSION=$Env:EMULSION_VERSION emulsion.nsi
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./distribution/windows/Emulsion-Installer.exe
asset_name: ${{ env.INSTALLER_NAME }}
asset_content_type: application/octet-stream
osx:
needs: create_release
runs-on: macos-latest
env:
INSTALLER_NAME: ${{ format('Emulsion-OSX-{0}.dmg', needs.create_release.outputs.version) }}
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Checkout code
uses: actions/checkout@v2
- name: Install cargo bundle
run: cargo install cargo-bundle
- name: Install avif build dependencies (macOS)
run: |
brew install meson ninja nasm
- name: Build dav1d (macOS)
env:
DAV1D_DIR: dav1d_dir
LIB_PATH: lib
run: |
git clone --branch 1.0.0 --depth 1 https://code.videolan.org/videolan/dav1d.git
cd dav1d
meson build -Dprefix=$HOME/$DAV1D_DIR --buildtype release
ninja -C build
ninja -C build install
echo "PKG_CONFIG_PATH=$HOME/$DAV1D_DIR/$LIB_PATH/pkgconfig" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$HOME/$DAV1D_DIR/$LIB_PATH" >> $GITHUB_ENV
- name: Create osx app
run: cargo bundle --release --features=avif
- name: Install create-dmg
run: npm install --global create-dmg
- name: Create .dmg file
run: ./distribution/macos/create_dmg.sh
- name: Rename .dmg
run: mv Emulsion*.dmg Emulsion.dmg
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: Emulsion.dmg
asset_name: ${{ env.INSTALLER_NAME }}
asset_content_type: application/octet-stream
linux:
needs: create_release
runs-on: ubuntu-20.04
env:
INSTALLER_NAME: ${{ format('Emulsion-Linux.deb-{0}.deb', needs.create_release.outputs.version) }}
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Checkout code
uses: actions/checkout@v2
- name: Install cargo bundle
run: cargo install cargo-bundle
- name: Install avif build dependencies (linux)
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y ninja-build nasm meson
- name: Build dav1d - avif dependency (linux)
env:
DAV1D_DIR: dav1d_dir
LIB_PATH: lib/x86_64-linux-gnu
run: |
git clone --branch 1.0.0 --depth 1 https://code.videolan.org/videolan/dav1d.git
cd dav1d
meson build -Dprefix=$HOME/$DAV1D_DIR --buildtype release
ninja -C build
ninja -C build install
echo "PKG_CONFIG_PATH=$HOME/$DAV1D_DIR/$LIB_PATH/pkgconfig" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$HOME/$DAV1D_DIR/$LIB_PATH" >> $GITHUB_ENV
- name: Create deb package
run: cargo bundle --release --features=avif
- name: Rename .deb
run: mv target/release/bundle/deb/*.deb Emulsion.deb
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: Emulsion.deb
asset_name: ${{ env.INSTALLER_NAME }}
asset_content_type: application/octet-stream