Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 42 additions & 22 deletions .github/workflows/gui-publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: GUI Publish

on:
# push:
# tags: [ "v*" ]
release:
types: [ published ]

Expand Down Expand Up @@ -32,7 +30,7 @@ jobs:

publish-gui:
needs: test
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
permissions:
contents: read
actions: write
Expand All @@ -41,13 +39,21 @@ jobs:
matrix:
include:
- rid: linux-x64
artifact: csv2ofx-gui-linux-x64
os: ubuntu-latest
package: appimage
artifact: csv2ofx-gui-linux-x64-package
- rid: osx-x64
artifact: csv2ofx-gui-osx-x64
os: macos-latest
package: macos-app
artifact: csv2ofx-gui-osx-x64-package
- rid: osx-arm64
artifact: csv2ofx-gui-osx-arm64
os: macos-latest
package: macos-app
artifact: csv2ofx-gui-osx-arm64-package
- rid: win-x64
artifact: csv2ofx-gui-win-x64
os: ubuntu-latest
package: zip
artifact: csv2ofx-gui-win-x64-package
steps:
- uses: actions/checkout@v4
- name: Setup .NET
Expand Down Expand Up @@ -75,21 +81,35 @@ jobs:
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:EnableCompressionInSingleFile=true \
-p:Version=${{ env.VERSION }} \
-o "artifacts/${{ matrix.artifact }}"
- name: Archive artifact
-o "artifacts/publish/${{ matrix.rid }}"
- name: Package Linux AppImage
if: matrix.package == 'appimage'
run: |
chmod +x build/package-linux-appimage.sh
build/package-linux-appimage.sh \
"artifacts/publish/${{ matrix.rid }}" \
"artifacts/packages" \
"${{ env.VERSION }}"
- name: Package macOS app bundle
if: matrix.package == 'macos-app'
run: |
chmod +x build/package-macos-app.sh
build/package-macos-app.sh \
"artifacts/publish/${{ matrix.rid }}" \
"artifacts/packages" \
"${{ matrix.rid }}" \
"${{ env.VERSION }}"
- name: Package Windows zip
if: matrix.package == 'zip'
run: |
cd artifacts
zip -r "${{ matrix.artifact }}-${{ env.VERSION }}.zip" "${{ matrix.artifact }}"
- name: Upload folder artifact
mkdir -p artifacts/packages
cd artifacts/publish/${{ matrix.rid }}
zip -r ../../packages/Csv2Ofx-${{ env.VERSION }}-${{ matrix.rid }}.zip .
- name: Upload packaged artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: artifacts/${{ matrix.artifact }}/
- name: Upload zip artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}-zip
path: artifacts/${{ matrix.artifact }}-${{ env.VERSION }}.zip
path: artifacts/packages/*

release:
needs: publish-gui
Expand All @@ -115,9 +135,9 @@ jobs:
with:
tag_name: ${{ github.ref_name }}
files: |
artifacts/csv2ofx-gui-linux-x64-zip/csv2ofx-gui-linux-x64-${{ env.VERSION }}.zip
artifacts/csv2ofx-gui-osx-x64-zip/csv2ofx-gui-osx-x64-${{ env.VERSION }}.zip
artifacts/csv2ofx-gui-osx-arm64-zip/csv2ofx-gui-osx-arm64-${{ env.VERSION }}.zip
artifacts/csv2ofx-gui-win-x64-zip/csv2ofx-gui-win-x64-${{ env.VERSION }}.zip
artifacts/csv2ofx-gui-linux-x64-package/Csv2Ofx-${{ env.VERSION }}-linux-x64.AppImage
artifacts/csv2ofx-gui-osx-x64-package/Csv2Ofx-${{ env.VERSION }}-osx-x64.app.zip
artifacts/csv2ofx-gui-osx-arm64-package/Csv2Ofx-${{ env.VERSION }}-osx-arm64.app.zip
artifacts/csv2ofx-gui-win-x64-package/Csv2Ofx-${{ env.VERSION }}-win-x64.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69 changes: 69 additions & 0 deletions build/package-linux-appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env bash
set -euo pipefail

if [ "$#" -ne 3 ]; then
echo "Usage: $0 <publish-dir> <output-dir> <version>" >&2
exit 1
fi

PUBLISH_DIR="$(cd "$1" && pwd)"
OUTPUT_DIR="$(mkdir -p "$2" && cd "$2" && pwd)"
VERSION="$3"

APP_NAME="Csv2Ofx"
EXECUTABLE="Csv2Ofx.Gui"
APP_ID="com.csv2ofx.gui"
APPDIR="$OUTPUT_DIR/$APP_NAME.AppDir"
APPIMAGE_TOOL="$OUTPUT_DIR/appimagetool-x86_64.AppImage"
APPIMAGE_PATH="$OUTPUT_DIR/$APP_NAME-$VERSION-linux-x64.AppImage"

rm -rf "$APPDIR"
mkdir -p \
"$APPDIR/usr/bin" \
"$APPDIR/usr/share/applications" \
"$APPDIR/usr/share/icons/hicolor/scalable/apps"

cp -a "$PUBLISH_DIR/." "$APPDIR/usr/bin/"
chmod +x "$APPDIR/usr/bin/$EXECUTABLE"

cat > "$APPDIR/AppRun" <<EOF
#!/usr/bin/env bash
HERE="\$(dirname "\$(readlink -f "\${0}")")"
exec "\$HERE/usr/bin/$EXECUTABLE" "\$@"
EOF
chmod +x "$APPDIR/AppRun"

cat > "$APPDIR/$APP_ID.desktop" <<EOF
[Desktop Entry]
Type=Application
Name=$APP_NAME
Comment=Convert CSV exports to OFX files
Exec=$EXECUTABLE
Icon=csv2ofx
Categories=Office;Finance;
Terminal=false
StartupWMClass=$EXECUTABLE
EOF
cp "$APPDIR/$APP_ID.desktop" "$APPDIR/usr/share/applications/$APP_ID.desktop"

cat > "$APPDIR/csv2ofx.svg" <<'EOF'
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
<rect width="128" height="128" rx="24" fill="#1f7a5c"/>
<path d="M30 26h50l18 18v58H30z" fill="#ffffff"/>
<path d="M80 26v19h18z" fill="#cfeee5"/>
<path d="M43 57h42M43 72h42M43 87h28" stroke="#1f7a5c" stroke-width="8" stroke-linecap="round"/>
</svg>
EOF
cp "$APPDIR/csv2ofx.svg" "$APPDIR/usr/share/icons/hicolor/scalable/apps/csv2ofx.svg"
ln -s "csv2ofx.svg" "$APPDIR/.DirIcon"

if [ ! -x "$APPIMAGE_TOOL" ]; then
curl -L \
"https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" \
-o "$APPIMAGE_TOOL"
chmod +x "$APPIMAGE_TOOL"
fi

rm -f "$APPIMAGE_PATH"
ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 "$APPIMAGE_TOOL" "$APPDIR" "$APPIMAGE_PATH"
chmod +x "$APPIMAGE_PATH"
63 changes: 63 additions & 0 deletions build/package-macos-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -euo pipefail

if [ "$#" -ne 4 ]; then
echo "Usage: $0 <publish-dir> <output-dir> <rid> <version>" >&2
exit 1
fi

PUBLISH_DIR="$(cd "$1" && pwd)"
OUTPUT_DIR="$(mkdir -p "$2" && cd "$2" && pwd)"
RID="$3"
VERSION="$4"

APP_NAME="Csv2Ofx"
EXECUTABLE="Csv2Ofx.Gui"
BUNDLE_ID="com.csv2ofx.gui"
APP_BUNDLE="$OUTPUT_DIR/$APP_NAME.app"
ZIP_PATH="$OUTPUT_DIR/$APP_NAME-$VERSION-$RID.app.zip"

rm -rf "$APP_BUNDLE" "$ZIP_PATH"
mkdir -p "$APP_BUNDLE/Contents/MacOS" "$APP_BUNDLE/Contents/Resources"

cp -a "$PUBLISH_DIR/." "$APP_BUNDLE/Contents/MacOS/"
chmod +x "$APP_BUNDLE/Contents/MacOS/$EXECUTABLE"

cat > "$APP_BUNDLE/Contents/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>$EXECUTABLE</string>
<key>CFBundleIdentifier</key>
<string>$BUNDLE_ID</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$APP_NAME</string>
<key>CFBundleDisplayName</key>
<string>$APP_NAME</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$VERSION</string>
<key>CFBundleVersion</key>
<string>$VERSION</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
EOF

if command -v codesign >/dev/null 2>&1; then
codesign --force --deep --sign - "$APP_BUNDLE"
fi

if command -v ditto >/dev/null 2>&1; then
ditto -c -k --sequesterRsrc --keepParent "$APP_BUNDLE" "$ZIP_PATH"
else
(cd "$OUTPUT_DIR" && zip -r "$(basename "$ZIP_PATH")" "$(basename "$APP_BUNDLE")")
fi
3 changes: 3 additions & 0 deletions src/Csv2Ofx.Gui/Csv2Ofx.Gui.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Csv2Ofx.Gui</AssemblyName>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>linux-x64;osx-x64;osx-arm64;win-x64</RuntimeIdentifiers>
<UseAppHost>true</UseAppHost>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
Loading