Skip to content

dev-desktop-builds #1896

dev-desktop-builds

dev-desktop-builds #1896

name: "dev-desktop-builds"
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
inputs:
sign_macos:
description: "Sign macOS version"
type: boolean
required: true
default: "false"
gen_doc:
description: "Generate documentation"
type: boolean
required: true
default: "true"
env:
GODOT_VERSION: 4.3
GODOT_SUB: stable
GODOT_DOWNLOAD_DIR: https://github.com/godotengine/godot-builds/releases/download/4.3-stable
EXPORT_NAME: material_maker
MM_RELEASE: 1_4a1
jobs:
export_windows_linux:
name: Export Windows and Linux 🗔
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v1
with:
submodules: true
- name: Setup 💻
run: |
wget -q ${GODOT_DOWNLOAD_DIR}/Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux.x86_64.zip
unzip Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux.x86_64.zip
wget -q ${GODOT_DOWNLOAD_DIR}/Godot_v${GODOT_VERSION}-${GODOT_SUB}_export_templates.tpz
unzip -a Godot_v${GODOT_VERSION}-${GODOT_SUB}_export_templates.tpz
mkdir -v -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_SUB}
mv ./templates/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.${GODOT_SUB}
sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install -y wine-stable && sudo apt-get install -y wine32
#chown root:root -R ~
wget -q https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe
mkdir -v -p ~/.local/share/rcedit
mv rcedit-x64.exe ~/.local/share/rcedit
#./Godot_v${GODOT_VERSION}-stable_linux.x86_64 --headless -q
mkdir -p ~/.config/godot
cd ~/.local/share/rcedit
RCEDIT_PATH=`pwd`
cd -
echo '[gd_resource type="EditorSettings" format=2]' >> ~/.config/godot/editor_settings-4.tres
echo '[resource]' >> ~/.config/godot/editor_settings-4.tres
echo 'export/windows/wine = "/usr/bin/wine"' >> ~/.config/godot/editor_settings-4.tres
echo 'export/windows/rcedit = "'$RCEDIT_PATH'/rcedit-x64.exe"' >> ~/.config/godot/editor_settings-4.tres
mkdir -v -p build/${EXPORT_NAME}_${MM_RELEASE}_windows build/${EXPORT_NAME}_${MM_RELEASE}_linux
- name: Generate Documentation
if: ${{ github.event.inputs.gen_doc == 'true' }}
uses: ammaraskar/sphinx-action@master
with:
docs-folder: "material_maker/doc"
- name: Windows Build 🗔
run: |
./Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux.x86_64 --headless -v --export-release "Windows" ./build/${EXPORT_NAME}_${MM_RELEASE}_windows/$EXPORT_NAME.exe
./Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux.x86_64 --headless -v --export-release "Windows" ./build/${EXPORT_NAME}_${MM_RELEASE}_windows/$EXPORT_NAME.exe
- name: Linux Build 🐧
run: |
./Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux.x86_64 --headless -v --export-release "Linux/X11" ./build/${EXPORT_NAME}_${MM_RELEASE}_linux/$EXPORT_NAME.x86_64
./Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux.x86_64 --headless -v --export-release "Linux/X11" ./build/${EXPORT_NAME}_${MM_RELEASE}_linux/$EXPORT_NAME.x86_64
- name: Copy Material Maker data 📁
run: |
cp -R ./addons/material_maker/nodes ./build/${EXPORT_NAME}_${MM_RELEASE}_windows
cp -R ./material_maker/environments ./build/${EXPORT_NAME}_${MM_RELEASE}_windows
cp -R ./material_maker/examples ./build/${EXPORT_NAME}_${MM_RELEASE}_windows
cp -R ./material_maker/library ./build/${EXPORT_NAME}_${MM_RELEASE}_windows
cp -R ./material_maker/meshes ./build/${EXPORT_NAME}_${MM_RELEASE}_windows
cp -R ./material_maker/misc/export ./build/${EXPORT_NAME}_${MM_RELEASE}_windows
cp -R ./material_maker/doc/_build/html ./build/${EXPORT_NAME}_${MM_RELEASE}_windows/doc || :
cp -R ./addons/material_maker/nodes ./build/${EXPORT_NAME}_${MM_RELEASE}_linux
cp -R ./material_maker/environments ./build/${EXPORT_NAME}_${MM_RELEASE}_linux
cp -R ./material_maker/examples ./build/${EXPORT_NAME}_${MM_RELEASE}_linux
cp -R ./material_maker/library ./build/${EXPORT_NAME}_${MM_RELEASE}_linux
cp -R ./material_maker/meshes ./build/${EXPORT_NAME}_${MM_RELEASE}_linux
cp -R ./material_maker/misc/export ./build/${EXPORT_NAME}_${MM_RELEASE}_linux
cp -R ./material_maker/doc/_build/html ./build/${EXPORT_NAME}_${MM_RELEASE}_linux/doc || :
- name: Create archives 📁
run: |
cd build
zip -r ${EXPORT_NAME}_${MM_RELEASE}_windows.zip ${EXPORT_NAME}_${MM_RELEASE}_windows
tar zcvf ${EXPORT_NAME}_${MM_RELEASE}_linux.tar.gz ${EXPORT_NAME}_${MM_RELEASE}_linux
- name: Upload Documentation 🚀
if: ${{ github.event.inputs.gen_doc == 'true' }}
uses: actions/upload-artifact@v4
with:
name: documentation
path: ./material_maker/doc/_build/html
- name: Upload Windows Artifact 🚀
uses: actions/upload-artifact@v4
with:
name: windows_snapshot
path: build/${{ env.EXPORT_NAME }}_${{ env.MM_RELEASE }}_windows.zip
- name: Upload Linux Artifact 🚀
uses: actions/upload-artifact@v4
with:
name: linux_snapshot
path: build/${{ env.EXPORT_NAME }}_${{ env.MM_RELEASE }}_linux.tar.gz
export-mac:
name: Mac Export 🍎
needs: export_windows_linux
runs-on: macos-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v1
with:
submodules: true
- name: Setup environment 🔧
run: |
export GODOT_VERSION=${GODOT_VERSION}
export EXPORT_NAME=material_maker
- name: Install the Apple certificate and provisioning profile
if: ${{ github.event.inputs.sign_macos == 'true' }}
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: "${{ secrets.KEYCHAIN_PASSWORD }}"
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Download and extract Godot and export templates 💾
run: |
wget ${GODOT_DOWNLOAD_DIR}/Godot_v${GODOT_VERSION}-${GODOT_SUB}_macos.universal.zip
unzip -a Godot_v${GODOT_VERSION}-${GODOT_SUB}_macos.universal.zip
wget ${GODOT_DOWNLOAD_DIR}/Godot_v${GODOT_VERSION}-${GODOT_SUB}_export_templates.tpz
unzip -a Godot_v${GODOT_VERSION}-${GODOT_SUB}_export_templates.tpz
mkdir -v -p "/Users/runner/Library/Application Support/Godot/export_templates/${GODOT_VERSION}.${GODOT_SUB}"
mv ./templates/* "/Users/runner/Library/Application Support/Godot/export_templates/${GODOT_VERSION}.${GODOT_SUB}"
- name: Mac Build 🔧
run: |
chown runner Godot.app/Contents/MacOS/Godot
chmod +x Godot.app/Contents/MacOS/Godot
mkdir -v -p ./build/mac
Godot.app/Contents/MacOS/Godot --headless -v --export-release "Mac OSX" ./build/mac/material_maker.zip
Godot.app/Contents/MacOS/Godot --headless -v --export-release "Mac OSX" ./build/mac/material_maker.zip
- name: Make application executable 🔧
run: |
unzip -a ./build/mac/material_maker.zip -d ./build/mac
chmod +x "./build/mac/Material Maker.app/Contents/MacOS/Material Maker"
rm ./build/mac/material_maker.zip
- name: Fix application icon 🖼
run: sips -s format icns "./build/mac/Material Maker.app/Contents/Resources/icon.icns" --out "./build/mac/Material Maker.app/Contents/Resources/icon.icns"
- name: Get documentation 🚀
if: ${{ github.event.inputs.gen_doc == 'true' }}
uses: actions/download-artifact@v4
with:
name: documentation
path: doc
- name: Copy data folder 📁
run: |
cp -R ./addons/material_maker/nodes "./build/mac/Material Maker.app/Contents/MacOS"
cp -R ./material_maker/environments "./build/mac/Material Maker.app/Contents/MacOS"
cp -R ./material_maker/examples "./build/mac/Material Maker.app/Contents/MacOS"
cp -R ./material_maker/library "./build/mac/Material Maker.app/Contents/MacOS"
cp -R ./material_maker/meshes "./build/mac/Material Maker.app/Contents/MacOS"
cp -R ./material_maker/misc/export "./build/mac/Material Maker.app/Contents/MacOS"
cp -R ./doc "./build/mac/Material Maker.app/Contents/MacOS/doc" || :
- name: Ad-hoc signing ✍️
if: ${{ github.event.inputs.sign_macos != 'true' }}
run: |
codesign -s - --force --deep "./build/mac/Material Maker.app"
- name: Signing ✍️
if: ${{ github.event.inputs.sign_macos == 'true' }}
run: |
codesign -s "Rodolphe Suescun" --force --options runtime --timestamp --deep "./build/mac/Material Maker.app"
- name: Create DMG archive 🔧
run: |
#hdiutil create -srcfolder ./build/mac -fs HFS+ -volname material_maker material_maker_${{ env.MM_RELEASE }}.dmg
wget https://github.com/create-dmg/create-dmg/archive/refs/tags/v1.2.2.zip
unzip v1.2.2.zip
create-dmg-1.2.2/create-dmg --volname "Material Maker" --icon-size 128 --background splash_screen/backgrounds/pavel_oliva_vintage_luggage.png --window-size 540 330 --icon "Material Maker.app" 158 125 --app-drop-link 384 125 --hide-extension "Material Maker.app" ./build/mac/material_maker_${{ env.MM_RELEASE }}.dmg ./build/mac
- name: Notarizing ✍️
if: ${{ github.event.inputs.sign_macos == 'true' }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
NOTARYTOOL_APP_PASSWORD: ${{ secrets.NOTARYTOOL_APP_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
xcrun notarytool submit ./build/mac/material_maker_${{ env.MM_RELEASE }}.dmg --apple-id $APPLE_ID --password $NOTARYTOOL_APP_PASSWORD --team-id $APPLE_TEAM_ID --wait
xcrun stapler staple ./build/mac/material_maker_${{ env.MM_RELEASE }}.dmg
- name: Upload Mac OSX Artifact 🚀
uses: actions/upload-artifact@v4
with:
name: macos_snapshot
path: ./build/mac/material_maker_${{ env.MM_RELEASE }}.dmg