Build Release #106
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 Release | |
on: | |
workflow_dispatch: | |
jobs: | |
create-release: | |
name: Create Release | |
runs-on: ubuntu-22.04 | |
outputs: | |
package_prefix: bevy-explorer-${{ steps.current_time_underscores.outputs.formattedTime }} | |
tag_name: alpha-${{ steps.current_time_dashes.outputs.formattedTime }} | |
if: github.repository == 'decentraland/bevy-explorer' || github.event_name == 'workflow_dispatch' | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
- name: Get current time with underscores | |
uses: 1466587594/[email protected] | |
id: current_time_underscores | |
with: | |
format: YYYY-MM-DD-HH-mm-ss | |
- name: Get current time with dashes | |
uses: 1466587594/[email protected] | |
id: current_time_dashes | |
with: | |
format: YYYY-MM-DD-HH-mm-ss | |
- name: Create release | |
id: create_release | |
run: | | |
tag_name="alpha-${{ steps.current_time_dashes.outputs.formattedTime }}" | |
release_name="Release ${{ steps.current_time_dashes.outputs.formattedTime }}" | |
gh release create "$tag_name" --title "$release_name" --generate-notes --prerelease | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
name: Build ${{ matrix.build_name }} | |
needs: create-release | |
strategy: | |
matrix: | |
include: | |
# linux livekit disabled until i figure out the multiple symbol definitions issue (webrtc and v8 both use abseil) | |
- build_name: linux-x86_64 | |
os: ubuntu-latest | |
- build_name: macos-m1m2 | |
os: macos-14-xlarge | |
# some ffmpeg thing is failing | |
# - build_name: macos-x86_64 | |
# os: macos-14-large | |
- build_name: windows-x86_64 | |
os: self-hosted-windows | |
# target: x86_64-pc-windows-msvc | |
env: | |
PACKAGE_FILE: ${{ needs.create-release.outputs.package_prefix }}-${{ matrix.build_name }}.${{ startsWith(matrix.build_name, 'lin') && 'tar.gz' || 'zip' }} | |
APPIMAGE_FILE: ${{ needs.create-release.outputs.package_prefix }}-${{ matrix.build_name }}.AppImage | |
CARGO_BUILD_DIR: target/release | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
# - uses: Swatinem/rust-cache@v2 | |
- name: add darwin target | |
if: runner.os == 'macos' | |
run: rustup target add aarch64-apple-darwin | |
- name: Install protoc | |
if: matrix.os != 'self-hosted-windows' | |
uses: arduino/setup-protoc@master | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install alsa and udev | |
if: runner.os == 'linux' | |
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev | |
- name: install livekit deps | |
if: runner.os == 'linux' | |
run: sudo apt update -y; sudo apt install -y libssl-dev libx11-dev libgl1-mesa-dev libxext-dev fuse | |
- name: install ffmpeg deps (linux) | |
run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev | |
if: runner.os == 'linux' | |
- name: install ffmpeg deps (macOs) | |
if: runner.os == 'macos' | |
run: | | |
brew install ffmpeg@6 pkg-config; | |
echo "PKG_CONFIG_PATH=/opt/homebrew/opt/ffmpeg@6/lib/pkgconfig" >> "$GITHUB_ENV" | |
- name: install ffmpeg deps (windows) | |
if: runner.os == 'windows' && matrix.os != 'self-hosted-windows' | |
run: | | |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) | |
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n" | |
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-6.0-full_build-shared.7z" -OutFile ffmpeg-6.0-full_build-shared.7z | |
7z x ffmpeg-6.0-full_build-shared.7z | |
mkdir ffmpeg | |
mv ffmpeg-*/* ffmpeg/ | |
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n" | |
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n" | |
- name: install ffmpeg deps (windows) | |
if: runner.os == 'windows' && matrix.os == 'self-hosted-windows' | |
run: | | |
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=c:\ffmpeg-6.0`n" | |
- name: Cargo build (windows) | |
if: runner.os == 'windows' | |
run: cargo build --release --bin decentra-bevy -j8 | |
- name: Cargo build (macos) | |
if: runner.os == 'macos' | |
run: cargo build --release --bin decentra-bevy | |
- name: Cargo build (linux) | |
if: runner.os == 'linux' | |
run: cargo build --release --bin decentra-bevy | |
- name: Package common | |
run: | | |
mkdir package | |
cp readme.md package/README.md | |
cp LICENSE package/LICENSE | |
cp -r assets package | |
- name: (macos) Preparing binary and librarys | |
if: runner.os == 'macos' | |
run: | | |
brew install dylibbundler | |
mv ${{ env.CARGO_BUILD_DIR }}/decentra-bevy . | |
dylibbundler -cd -b -x decentra-bevy -d ./libs | |
- name: Package Macos | |
if: runner.os == 'macos' | |
env: | |
MACOS_CSC_CONTENT: ${{ secrets.MACOS_CSC_CONTENT }} | |
MACOS_CSC_KEY_PASSWORD: ${{ secrets.MACOS_CSC_KEY_PASSWORD }} | |
MACOS_DEVELOPER_ID: ${{ secrets.MACOS_DEVELOPER_ID }} | |
MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }} | |
MACOS_NOTARIZATION_PWD: ${{ secrets.MACOS_NOTARIZATION_PWD }} | |
MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd deploy/macos | |
bash build.sh | |
mv DecentralandBevyExplorer.zip ../../${{ env.PACKAGE_FILE }} | |
- name: Package Windows | |
if: runner.os == 'Windows' | |
continue-on-error: true | |
run: | | |
cp ${{ env.CARGO_BUILD_DIR }}/decentra-bevy.exe package/decentra-bevy.exe | |
cp ${{ env.FFMPEG_DIR }}/bin/*.dll package | |
7z a ${{ env.PACKAGE_FILE }} ./package/* | |
- name: Package Linux | |
if: runner.os == 'linux' | |
continue-on-error: true | |
run: | | |
cp ${{ env.CARGO_BUILD_DIR }}/decentra-bevy package/decentra-bevy | |
# We must enter the package/ directory in order to create a flat tarball (i.e. without a directory in it). | |
cd package | |
tar -czvf ../${{ env.PACKAGE_FILE }} * | |
- name: Package AppImage | |
if: runner.os == 'linux' | |
continue-on-error: true | |
run: | | |
cd deploy/linux | |
mkdir BevyExplorer.AppDir/usr | |
mkdir BevyExplorer.AppDir/usr/bin | |
cp ../../target/release/decentra-bevy BevyExplorer.AppDir/usr/bin | |
cp ../../assets BevyExplorer.AppDir/usr/bin -r | |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
wget https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage | |
chmod +x ./linuxdeploy-x86_64.AppImage | |
chmod +x ./appimagetool-x86_64.AppImage | |
./linuxdeploy-x86_64.AppImage --appdir BevyExplorer.AppDir --output appimage --create-desktop-file --executable=../../target/release/decentra-bevy --icon-file=decentra-bevy.png | |
mv ./decentra-bevy-x86_64.AppImage ${{ env.APPIMAGE_FILE }} | |
gh release upload "${{ needs.create-release.outputs.tag_name }}" ${{ env.APPIMAGE_FILE }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload package | |
continue-on-error: true | |
run: gh release upload "${{ needs.create-release.outputs.tag_name }}" "${{ env.PACKAGE_FILE }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |