Skip to content

Try to fix macos CI... #1600

Try to fix macos CI...

Try to fix macos CI... #1600

name: "dev-desktop-builds"
on:
push:
branches: [ master, material_maker_1_3 ]
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
sign_macos:
description: 'Sign macOS version'
type: boolean
required: true
default: 'false'
env:
GODOT_VERSION: 3.5.3
GODOT_SUB: stable
GODOT_DOWNLOAD_URL: https://github.com/godotengine/godot/releases/download
GODOT_MAC_HEADLESS_DOWNLOAD_URL: https://github.com/huskeee/godot-headless-mac/releases/download
EXPORT_NAME: material_maker
MM_RELEASE: 1_3
jobs:
export_windows_linux:
name: Export Windows and Linux 🗔
runs-on: ubuntu-latest
container:
image: docker://barichello/godot-ci:3.5
steps:
- name: Checkout 🛎️
uses: actions/checkout@v1
with:
submodules: true
- name: Setup 💻
run: |
wget -q ${GODOT_DOWNLOAD_URL}/${GODOT_VERSION}-${GODOT_SUB}/Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux_headless.64.zip
unzip Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux_headless.64.zip
wget -q ${GODOT_DOWNLOAD_URL}/${GODOT_VERSION}-${GODOT_SUB}/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}
dpkg --add-architecture i386 && apt-get update && apt-get install -y wine-stable && apt-get install -y wine32
ls -la /usr/bin
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}-${GODOT_SUB}_linux_headless.64 -q
mkdir -p ~/.config/godot
cd ~/.local/share/rcedit
RCEDIT_PATH=`pwd`
cd -
echo '[gd_resource type="EditorSettings" format=2]' >> ~/.config/godot/editor_settings-3.tres
echo '[resource]' >> ~/.config/godot/editor_settings-3.tres
echo 'export/windows/wine = "/usr/bin/wine"' >> ~/.config/godot/editor_settings-3.tres
echo 'export/windows/rcedit = "'$RCEDIT_PATH'/rcedit-x64.exe"' >> ~/.config/godot/editor_settings-3.tres
mkdir -v -p build/${EXPORT_NAME}_${MM_RELEASE}_windows build/${EXPORT_NAME}_${MM_RELEASE}_linux
- name: Generate Documentation
uses: ammaraskar/sphinx-action@master
with:
docs-folder: "material_maker/doc"
- name: Windows Build 🗔
run: ./Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux_headless.64 -v --export "Windows" ./build/${EXPORT_NAME}_${MM_RELEASE}_windows/$EXPORT_NAME.exe
- name: Linux Build 🐧
run: ./Godot_v${GODOT_VERSION}-${GODOT_SUB}_linux_headless.64 -v --export "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 🚀
uses: actions/upload-artifact@v3
with:
name: documentation
path: ./material_maker/doc/_build/html
- name: Upload Windows Artifact 🚀
uses: actions/upload-artifact@v3
with:
name: windows_snapshot
path: build/${{ env.EXPORT_NAME }}_${{ env.MM_RELEASE }}_windows.zip
- name: Upload Linux Artifact 🚀
uses: actions/upload-artifact@v3
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}-${GODOT_SUB}
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 export templates 💾
run: |
mkdir -v -p ~/.local/share/godot/templates/${GODOT_VERSION}.${GODOT_SUB}
curl -O ${GODOT_DOWNLOAD_URL}/${GODOT_VERSION}-${GODOT_SUB}/Godot_v${GODOT_VERSION}-${GODOT_SUB}_export_templates.tpz
ls -la
unzip -a Godot_v${GODOT_VERSION}-${GODOT_SUB}_export_templates.tpz
mv ./templates/* ~/.local/share/godot/templates/${GODOT_VERSION}.${GODOT_SUB}
- name: Download Godot headless binary 🤖
run: |
wget -q ${GODOT_MAC_HEADLESS_DOWNLOAD_URL}/${GODOT_VERSION}-${GODOT_SUB}/Godot_${GODOT_VERSION}-${GODOT_SUB}_mac_headless.64.zip
- name: Setup 💻
run: mkdir -v -p ./build/mac
- name: Mac Build 🔧
run: |
chown runner bin/godot
chmod +x bin/godot
bin/godot -v --export "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 🚀
uses: actions/download-artifact@v3
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 ./build/mac/material_maker_${{ env.MM_RELEASE }}.dmg
- 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@v3
with:
name: macos_snapshot
path: ./build/mac/material_maker_${{ env.MM_RELEASE }}.dmg