Browse Source

customize mac dmg

pull/588/head
Jason Dove 4 years ago
parent
commit
c4c97fcc8c
  1. 36
      .github/workflows/artifacts.yml
  2. 16
      gon.json
  3. 6
      scripts/macOS/ErsatzTV.entitlements
  4. 26
      scripts/macOS/Info.plist
  5. 26
      scripts/macOS/bundle.sh
  6. 10
      scripts/macOS/sign-dmg.sh
  7. 10
      scripts/macOS/sign.sh

36
.github/workflows/artifacts.yml

@ -27,7 +27,7 @@ on:
required: true required: true
jobs: jobs:
build_and_upload_mac: build_and_upload_mac:
name: Build & Upload Mac Artifacts name: Mac Build & Upload
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
if: contains(github.event.head_commit.message, '[no build]') == false if: contains(github.event.head_commit.message, '[no build]') == false
strategy: strategy:
@ -69,14 +69,35 @@ jobs:
echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV
- name: Build - name: Build
shell: bash
run: dotnet publish ErsatzTV/ErsatzTV.csproj --framework net6.0 --runtime "${{ matrix.target }}" -c Release -o publish -p:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" -p:EnableCompressionInSingleFile=true -p:DebugType=Embedded -p:PublishSingleFile=true --self-contained true
- name: Bundle
shell: bash shell: bash
run: | run: |
dotnet msbuild ErsatzTV/ErsatzTV.csproj -t:BundleApp -p:RuntimeIdentifier="${{ matrix.target }}" -p:CFBundleVersion="${{ inputs.info_version }}" -p:Configuration=Release -p:CFBundleShortVersionString="${{ inputs.info_version }}" -p:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" -p:PublishDir=$(pwd)/release plutil -replace CFBundleShortVersionString -string "${{ inputs.info_version }}" scripts/macOS/Info.plist
cp scripts/macOS/launcher.sh release/ErsatzTV.app/Contents/MacOS/ plutil -replace CFBundleVersion -string "${{ inputs.info_version }}" scripts/macOS/Info.plist
scripts/macOS/bundle.sh
- name: Sign - name: Sign
shell: bash shell: bash
run: scripts/macOS/sign.sh run: scripts/macOS/sign.sh
- name: Create DMG
shell: bash
run: |
brew install create-dmg
create-dmg \
--volname "ErsatzTV" \
--volicon "artwork/ErsatzTV.icns" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "ErsatzTV.app" 200 190 \
--hide-extension "ErsatzTV.app" \
--app-drop-link 600 185 \
"ErsatzTV.dmg" \
"ErsatzTV.app/"
- name: Notarize - name: Notarize
shell: bash shell: bash
@ -91,8 +112,9 @@ jobs:
- name: Cleanup - name: Cleanup
shell: bash shell: bash
run: | run: |
mv release/ErsatzTV.dmg "${{ env.RELEASE_NAME }}.dmg" mv ErsatzTV.dmg "${{ env.RELEASE_NAME }}.dmg"
rm -r release rm -r publish
rm -r ErsatzTV.app
- name: Delete old release assets - name: Delete old release assets
uses: mknejp/delete-release-assets@v1 uses: mknejp/delete-release-assets@v1
@ -113,7 +135,7 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.gh_token }} GITHUB_TOKEN: ${{ secrets.gh_token }}
build_and_upload: build_and_upload:
name: Build & Upload Artifacts name: Build & Upload
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
if: contains(github.event.head_commit.message, '[no build]') == false if: contains(github.event.head_commit.message, '[no build]') == false
strategy: strategy:
@ -153,7 +175,7 @@ jobs:
echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV
# Build everything # Build everything
dotnet publish ErsatzTV/ErsatzTV.csproj --framework net6.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" /property:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" /property:EnableCompressionInSingleFile=true /property:DebugType=Embedded /property:PublishSingleFile=true --self-contained true dotnet publish ErsatzTV/ErsatzTV.csproj --framework net6.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" -p:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" -p:EnableCompressionInSingleFile=true -p:DebugType=Embedded -p:PublishSingleFile=true --self-contained true
# Pack files # Pack files
if [ "${{ matrix.kind }}" == "windows" ]; then if [ "${{ matrix.kind }}" == "windows" ]; then

16
gon.json

@ -1,15 +1,11 @@
{ {
"source" : ["./release/ErsatzTV.app"], "notarize": [{
"bundle_id" : "com.jasongdove.ersatztv", "path": "./ErsatzTV.dmg",
"bundle_id": "com.jasongdove.ersatztv",
"staple": true
}],
"apple_id": { "apple_id": {
"password": "@env:AC_PASSWORD" "password": "@env:AC_PASSWORD"
},
"sign" :{
"application_identity" : "C3BBCFB2D6851FF0DCA6CAC06A3EF1ECE71F9FFF",
"entitlements_file": "./scripts/macOS/ErsatzTV.entitlements"
},
"dmg" :{
"output_path": "./release/ErsatzTV.dmg",
"volume_name": "ErsatzTV"
} }
} }

6
scripts/macOS/ErsatzTV.entitlements

@ -6,5 +6,11 @@
<true/> <true/>
<key>com.apple.security.automation.apple-events</key> <key>com.apple.security.automation.apple-events</key>
<true/> <true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict> </dict>
</plist> </plist>

26
scripts/macOS/Info.plist

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>ErsatzTV</string>
<key>CFBundleExecutable</key>
<string>launcher.sh</string>
<key>CFBundleIconFile</key>
<string>ErsatzTV.icns</string>
<key>CFBundleIdentifier</key>
<string>com.jasongdove.ersatztv</string>
<key>CFBundleName</key>
<string>ErsatzTV</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.3.7-alpha</string>
<key>CFBundleVersion</key>
<string>0.3.7-alpha</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

26
scripts/macOS/bundle.sh

@ -0,0 +1,26 @@
#! /bin/bash
SCRIPT_FOLDER=$(dirname ${BASH_SOURCE[0]})
REPO_ROOT="$SCRIPT_FOLDER/../.."
APP_NAME="$REPO_ROOT/ErsatzTV.app"
PUBLISH_OUTPUT_DIRECTORY="$REPO_ROOT/publish/."
INFO_PLIST="$SCRIPT_FOLDER/Info.plist"
ICON_SOURCE="$REPO_ROOT/artwork/ErsatzTV.icns"
ICON_FILE="ErsatzTV.icns"
if [ -d "$APP_NAME" ]
then
rm -rf "$APP_NAME"
fi
mkdir "$APP_NAME"
mkdir "$APP_NAME/Contents"
mkdir "$APP_NAME/Contents/MacOS"
mkdir "$APP_NAME/Contents/Resources"
cp "$INFO_PLIST" "$APP_NAME/Contents/Info.plist"
cp "$ICON_SOURCE" "$APP_NAME/Contents/Resources/$ICON_FILE"
cp -a "$PUBLISH_OUTPUT_DIRECTORY" "$APP_NAME/Contents/MacOS"
cp "$SCRIPT_FOLDER/launcher.sh" "$APP_NAME/Contents/MacOS/"

10
scripts/macOS/sign-dmg.sh

@ -0,0 +1,10 @@
#! /bin/bash
SCRIPT_FOLDER=$(dirname ${BASH_SOURCE[0]})
REPO_ROOT="$SCRIPT_FOLDER/../.."
DMG_NAME="$REPO_ROOT/ErsatzTV.dmg"
ENTITLEMENTS="$SCRIPT_FOLDER/ErsatzTV.entitlements"
SIGNING_IDENTITY="C3BBCFB2D6851FF0DCA6CAC06A3EF1ECE71F9FFF"
codesign --force --timestamp --options=runtime --entitlements "$ENTITLEMENTS" --sign "$SIGNING_IDENTITY" "$DMG_NAME"

10
scripts/macOS/sign.sh

@ -1,6 +1,10 @@
#! /bin/bash #! /bin/bash
APP_NAME="release/ErsatzTV.app"
ENTITLEMENTS="scripts/macOS/ErsatzTV.entitlements" SCRIPT_FOLDER=$(dirname ${BASH_SOURCE[0]})
REPO_ROOT="$SCRIPT_FOLDER/../.."
APP_NAME="$REPO_ROOT/ErsatzTV.app"
ENTITLEMENTS="$SCRIPT_FOLDER/ErsatzTV.entitlements"
SIGNING_IDENTITY="C3BBCFB2D6851FF0DCA6CAC06A3EF1ECE71F9FFF" SIGNING_IDENTITY="C3BBCFB2D6851FF0DCA6CAC06A3EF1ECE71F9FFF"
find "$APP_NAME/Contents/MacOS/"|while read fname; do find "$APP_NAME/Contents/MacOS/"|while read fname; do

Loading…
Cancel
Save