Bundle on pack instead of deploy

This commit is contained in:
Yudi 2025-05-05 10:15:22 -03:00
parent 56d47efab8
commit 4d9bd4afe4
No known key found for this signature in database
GPG key ID: E4743B2F033961D1

View file

@ -138,42 +138,62 @@ jobs:
--runtime ${{ matrix.rid }}
--self-contained
- name: Set permissions
if: ${{ !startsWith(matrix.rid, 'win-') }}
run: chmod +x ${{ matrix.app }}/bin/publish/${{ matrix.asset }}
- name: Generate macOS .app bundle resources
if: matrix.app == 'DiscordChatExporter.Gui' && startsWith(matrix.rid, 'osx-')
run: |
STAGING_DIR="app-bundle-staging"
APP_NAME="${{ matrix.asset }}.app"
APP_DIR="$STAGING_DIR/$APP_NAME"
CONTENTS_DIR="$APP_DIR/Contents"
MACOS_DIR="$CONTENTS_DIR/MacOS"
RESOURCES_DIR="$CONTENTS_DIR/Resources"
PUBLISH_DIR="${{ matrix.app }}/bin/publish"
# Create directory structure for macOS app bundle
mkdir -p "$MACOS_DIR" "$RESOURCES_DIR"
# Move icon to the .app/Resources directory
mv "favicon.icns" "$RESOURCES_DIR/${{ matrix.asset }}.icns"
# Create the Information Property List file
# This file will be used in the .app bundle generated on the deploy job
cat > ${{ matrix.app }}/bin/publish/Info.plist << EOF
<?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>CFBundleExecutable</key>
<string>DiscordChatExporter</string>
<key>NSHumanReadableCopyright</key>
<string>© Oleksii Holub</string>
<key>CFBundleIdentifier</key>
<string>com.Tyrrrz.${{ matrix.asset }}</string>
<key>CFBundleName</key>
<string>${{ matrix.asset }}</string>
<key>CFBundleDisplayName</key>
<string>${{ matrix.asset }}</string>
<key>CFBundleSpokenName</key>
<string>Discord Chat Exporter</string>
<key>CFBundleVersion</key>
<string>${{ github.sha }}</string>
<key>CFBundleShortVersionString</key>
<string>${{ github.ref_type == 'tag' && github.ref_name || '999.9.9-ci' }}</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>
cat > $CONTENTS_DIR/Info.plist << EOF
<?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>CFBundleExecutable</key>
<string>DiscordChatExporter</string>
<key>NSHumanReadableCopyright</key>
<string>© Oleksii Holub</string>
<key>CFBundleIdentifier</key>
<string>com.Tyrrrz.${{ matrix.asset }}</string>
<key>CFBundleName</key>
<string>${{ matrix.asset }}</string>
<key>CFBundleDisplayName</key>
<string>${{ matrix.asset }}</string>
<key>CFBundleSpokenName</key>
<string>Discord Chat Exporter</string>
<key>CFBundleVersion</key>
<string>${{ github.sha }}</string>
<key>CFBundleShortVersionString</key>
<string>${{ github.ref_type == 'tag' && github.ref_name || '999.9.9-ci' }}</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>
EOF
# This icon will be used in the .app bundle generated on the deploy job
mv favicon.icns ${{ matrix.app }}/bin/publish/DiscordChatExporter.icns
# Move all remaining files to the MacOS directory
find "$PUBLISH_DIR" -maxdepth 1 -mindepth 1 -exec mv "{}" "$MACOS_DIR/" \;
# Move final .app bundle to the publish directory
mv "$APP_DIR" "$PUBLISH_DIR"
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@ -246,32 +266,6 @@ jobs:
name: ${{ matrix.asset }}.${{ matrix.rid }}
path: ${{ matrix.app }}/
- name: Set permissions
if: ${{ !startsWith(matrix.rid, 'win-') }}
run: chmod +x ${{ matrix.app }}/${{ matrix.asset }}
- name: Create macOS .app bundle
if: matrix.app == 'DiscordChatExporter.Gui' && startsWith(matrix.rid, 'osx-')
run: |
STAGING_DIR="app-bundle-staging"
APP_NAME="${{ matrix.asset }}.app"
APP_DIR="$STAGING_DIR/$APP_NAME"
MACOS_DIR="$APP_DIR/Contents/MacOS"
RESOURCES_DIR="$APP_DIR/Contents/Resources"
# Create directory structure outside the source dir
mkdir -p "$MACOS_DIR" "$RESOURCES_DIR"
# Move Info.plist and icon to specific locations
mv "${{ matrix.app }}/Info.plist" "$APP_DIR/Contents/"
mv "${{ matrix.app }}/DiscordChatExporter.icns" "$RESOURCES_DIR/"
# Move all remaining files to the MacOS directory
find "${{ matrix.app }}" -maxdepth 1 -mindepth 1 -exec mv "{}" "$MACOS_DIR/" \;
# Move final .app bundle to the source directory so it can be zipped
mv "$APP_DIR" "${{ matrix.app }}/$APP_NAME"
- name: Create package
# Change into the artifacts directory to avoid including the directory itself in the zip archive
working-directory: ${{ matrix.app }}/