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 }} --runtime ${{ matrix.rid }}
--self-contained --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 - name: Generate macOS .app bundle resources
if: matrix.app == 'DiscordChatExporter.Gui' && startsWith(matrix.rid, 'osx-') if: matrix.app == 'DiscordChatExporter.Gui' && startsWith(matrix.rid, 'osx-')
run: | 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 # Create the Information Property List file
# This file will be used in the .app bundle generated on the deploy job cat > $CONTENTS_DIR/Info.plist << EOF
cat > ${{ matrix.app }}/bin/publish/Info.plist << EOF <?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0">
<plist version="1.0"> <dict>
<dict> <key>CFBundleExecutable</key>
<key>CFBundleExecutable</key> <string>DiscordChatExporter</string>
<string>DiscordChatExporter</string> <key>NSHumanReadableCopyright</key>
<key>NSHumanReadableCopyright</key> <string>© Oleksii Holub</string>
<string>© Oleksii Holub</string> <key>CFBundleIdentifier</key>
<key>CFBundleIdentifier</key> <string>com.Tyrrrz.${{ matrix.asset }}</string>
<string>com.Tyrrrz.${{ matrix.asset }}</string> <key>CFBundleName</key>
<key>CFBundleName</key> <string>${{ matrix.asset }}</string>
<string>${{ matrix.asset }}</string> <key>CFBundleDisplayName</key>
<key>CFBundleDisplayName</key> <string>${{ matrix.asset }}</string>
<string>${{ matrix.asset }}</string> <key>CFBundleSpokenName</key>
<key>CFBundleSpokenName</key> <string>Discord Chat Exporter</string>
<string>Discord Chat Exporter</string> <key>CFBundleVersion</key>
<key>CFBundleVersion</key> <string>${{ github.sha }}</string>
<string>${{ github.sha }}</string> <key>CFBundleShortVersionString</key>
<key>CFBundleShortVersionString</key> <string>${{ github.ref_type == 'tag' && github.ref_name || '999.9.9-ci' }}</string>
<string>${{ github.ref_type == 'tag' && github.ref_name || '999.9.9-ci' }}</string> <key>NSHighResolutionCapable</key>
<key>NSHighResolutionCapable</key> <true/>
<true/> <key>CFBundlePackageType</key>
<key>CFBundlePackageType</key> <string>APPL</string>
<string>APPL</string> </dict>
</dict> </plist>
</plist>
EOF EOF
# This icon will be used in the .app bundle generated on the deploy job # Move all remaining files to the MacOS directory
mv favicon.icns ${{ matrix.app }}/bin/publish/DiscordChatExporter.icns 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 - name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@ -246,32 +266,6 @@ jobs:
name: ${{ matrix.asset }}.${{ matrix.rid }} name: ${{ matrix.asset }}.${{ matrix.rid }}
path: ${{ matrix.app }}/ 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 - name: Create package
# Change into the artifacts directory to avoid including the directory itself in the zip archive # Change into the artifacts directory to avoid including the directory itself in the zip archive
working-directory: ${{ matrix.app }}/ working-directory: ${{ matrix.app }}/