Skip to content

Build

Build #31

Workflow file for this run

name: Build
on:
workflow_run:
workflows: ["Run Tests"]
branches: [master]
types:
- completed
env:
CARGO_TERM_COLOR: always
jobs:
build_windows:
strategy:
matrix:
app: [icy_term, icy_draw, icy_view, icy_play]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Prepare FILE_ID.DIZ
run: |
$VERSION=$(python tools\prep_diz.py ".\crates\${{ matrix.app }}\" "file_id.diz")
echo "Version: $VERSION"
Add-Content -Path $env:GITHUB_ENV -Value "VERSION=$VERSION"
get-content .\crates\${{ matrix.app }}\build\file_id.diz | %{$_ -replace "#VERSION","$VERSION"} >file_id.diz
- name: Build exe
run: |
cd .\crates\${{ matrix.app }}
cargo build --release
cd ..\..
move .\target\release\${{ matrix.app }}.exe .
- name: 'Upload executable'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.app }}_${{ env.VERSION }}_windows
path: |
${{ matrix.app }}.exe
file_id.diz
build_mac:
strategy:
matrix:
app: [icy_term, icy_draw, icy_view]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install cargo bundle & get
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
cargo install cargo-bundle
brew install create-dmg
- name: Build dmg
run: |
cd crates/${{ matrix.app }}
cargo build --release --target aarch64-apple-darwin
cargo build --release --target x86_64-apple-darwin
cd ../..
mkdir -p "${{ matrix.app }}.app/Contents/MacOS"
mkdir -p "${{ matrix.app }}.app/Contents/Resources"
cp crates/${{ matrix.app }}/build/mac/Info.plist "${{ matrix.app }}.app/Contents/Info.plist"
mkdir -p AppIcon.iconset
sips -z 16 16 crates/${{ matrix.app }}/build/mac/128x128@2x.png --out AppIcon.iconset/icon_16x16.png
sips -z 32 32 crates/${{ matrix.app }}/build/mac/128x128@2x.png --out AppIcon.iconset/icon_16x16@2x.png
sips -z 32 32 crates/${{ matrix.app }}/build/mac/128x128@2x.png --out AppIcon.iconset/icon_32x32.png
sips -z 64 64 crates/${{ matrix.app }}/build/mac/128x128@2x.png --out AppIcon.iconset/icon_32x32@2.png
sips -z 128 128 crates/${{ matrix.app }}/build/mac/128x128@2x.png --out AppIcon.iconset/icon_128x128.png
cp crates/${{ matrix.app }}/build/mac/128x128@2x.png AppIcon.iconset/icon_128x128@2x.png
iconutil -c icns AppIcon.iconset
cp AppIcon.icns "${{ matrix.app }}.app/Contents/Resources"
export version=$(python3 tools/prep_diz.py "crates/${{ matrix.app }}/" "file_id.diz")
echo "VERSION=$version" >> $GITHUB_ENV
echo "Version: $version"
lipo "target/x86_64-apple-darwin/release/${{ matrix.app }}" \
"target/aarch64-apple-darwin/release/${{ matrix.app }}" \
-create -output "${{ matrix.app }}.app/Contents/MacOS/${{ matrix.app }}"
# - name: Install the Apple certificate and provisioning profile
# env:
# BUILD_CERTIFICATE_BASE64: ${{ secrets.OSX_CERTIFICATE_BASE64 }}
# P12_PASSWORD: ${{ secrets.OSX_CERTIFICATE_PASSWORD }}
# KEYCHAIN_PASSWORD: ${{ secrets.OSX_CERTIFICATE_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 -o $CERTIFICATE_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
#
- name: Sign dmg
id: sign-bundle
run: |
#codesign --force --deep --verbose --sign "mkrueger@posteo.de" "target/x86_64-apple-darwin/release/bundle/osx/${MAC_APP}.app/"
#codesign --force --deep --verbose --sign "mkrueger@posteo.de" "target/aarch64-apple-darwin/release/bundle/osx/${MAC_APP}.app/"
create-dmg \
--volname "${{ matrix.app }} Installer" \
--volicon "AppIcon.icns" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 128 \
--hide-extension "${{ matrix.app }}.app" \
--app-drop-link 600 185 \
"${{ matrix.app }}-${{ env.VERSION }}-universal.dmg" \
"${{ matrix.app }}.app"
# - name: Clean up keychain and provisioning profile
# run: |
# security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
# # rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision
- name: 'Upload dmg'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.app }}_osx_${{ env.VERSION }}${{ matrix.target }}
path: |
${{ matrix.app }}-${{ env.VERSION }}-universal.dmg
file_id.diz