Skip to content

Merge pull request #115 from LeCraft2Ouf/main #193

Merge pull request #115 from LeCraft2Ouf/main

Merge pull request #115 from LeCraft2Ouf/main #193

Workflow file for this run

name: Build and Package
on:
push:
branches:
- main
jobs:
build-macos:
runs-on: macos-latest
steps:
- name: πŸ“ | Checkout repository
uses: actions/checkout@v2
- name: πŸ“ | Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
- name: πŸ—οΈ | Build and publish for macOS
run: |
cd SkEditor
for arch in osx-x64 osx-arm64; do
dotnet restore
dotnet publish -c Release -r $arch -p:PublishSingleFile=true -p:PublishReadyToRun=true --no-self-contained --nologo -v q --property WarningLevel=0 /clp:ErrorsOnly /p:DebugType=None /p:DebugSymbols=false
done
- name: πŸ› οΈ | Create .app structure and zip for both architectures
run: |
for arch in osx-x64 osx-arm64; do
mkdir -p "SkEditor.app/Contents/MacOS"
mkdir -p "SkEditor.app/Contents/Resources"
cp -r SkEditor/bin/Release/net8.0/$arch/publish/* "SkEditor.app/Contents/MacOS/"
cp SkEditor/Info.plist "SkEditor.app/Contents/"
cp SkEditor/SkEditor.icns "SkEditor.app/Contents/Resources/"
find SkEditor.app/Contents/MacOS/ -type f -exec chmod +x {} \;
zip -r "SkEditorMac-$arch.zip" SkEditor.app
mv "SkEditorMac-$arch.zip" "$arch-SkEditorMac.zip"
done
- name: πŸ“€ | Upload macOS artifacts
uses: actions/upload-artifact@v2
with:
name: SkEditorMac
path: "*.zip"
build-linux-debian:
runs-on: ubuntu-latest
steps:
- name: πŸ“ | Checkout repository
uses: actions/checkout@v2
- name: πŸ“ | Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
- name: πŸ—οΈ | Build and publish for Debian
run: |
cd SkEditor
for arch in linux-x64 linux-arm64; do
dotnet restore
dotnet publish -c Release -r $arch -p:PublishSingleFile=true -p:PublishReadyToRun=true --no-self-contained /p:DebugType=None /p:DebugSymbols=false
done
- name: πŸ“Œ | Install Dependencies
run: |
sudo apt update
sudo apt install wget curl imagemagick -y
- name: πŸ› οΈ | Create .deb structure
run: |
for arch in x64 arm64; do
mkdir -p "SkEditorFiles-$arch/opt/SkEditor"
cp -r SkEditor/bin/Release/net8.0/linux-$arch/publish/* "SkEditorFiles-$arch/opt/SkEditor/"
mkdir -p "SkEditorFiles-$arch/usr/share/applications"
wget -O SkEditorFiles-$arch/usr/share/applications/SkEditor.desktop 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/ce4a0b2a782e73500aafde3ee24eb8ebf1194f98/SkEditor.desktop'
wget -O SkEditorFiles-$arch/opt/SkEditor/SkEditor.png 'https://raw.githubusercontent.com/SkEditorTeam/SkEditor/main/SkEditor.png'
mkdir -p SkEditorFiles-$arch/usr/share/mime/application
wget -O SkEditorFiles-$arch/usr/share/mime/application/skript.xml 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/6d9cd730ecc86d8113b70b579627b11ff731ad6b/skript.xml'
mkdir -p "SkEditorFiles-$arch/DEBIAN"
wget -O SkEditorFiles-$arch/DEBIAN/control 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/fb98edb82e7df9c973ed80545fb2758caed65692/control'
done
- name: πŸ” | Extract version, measure size, and update control file
run: |
version=$(grep -oP '(?<=<InformationalVersion>).*?(?=</InformationalVersion>)' SkEditor/SkEditor.csproj)
for arch in x64 arm64; do
size=$(du -s --block-size=K SkEditorFiles-$arch/opt/SkEditor | cut -f1 | tr -d 'K')
echo "Version: $version-b${{ github.run_number }}" >> SkEditorFiles-$arch/DEBIAN/control
echo -e "\nVersion=$version" >> SkEditorFiles-$arch/usr/share/applications/SkEditor.desktop
if [ "$arch" = "x64" ]; then
architecture="amd64"
else
architecture="$arch"
fi
echo "Architecture: $architecture" >> SkEditorFiles-$arch/DEBIAN/control
done
- name: πŸ” | Calculate MD5 and SHA256 checksums
run: |
for arch in x64 arm64; do
cd SkEditorFiles-$arch/
find . -type f -not -path './DEBIAN/*' -exec md5sum {} + | sed 's| \./| |' > DEBIAN/md5sums
find . -type f -not -path './DEBIAN/*' -exec sha256sum {} + | sed 's| \./| |' > DEBIAN/sha256sums
cd -
done
- name: 🎨 | Resize icon and create icon directories
run: |
for arch in x64 arm64; do
sizes=(16 24 32 48 64 128 256)
for size in "${sizes[@]}"; do
mkdir -p "SkEditorFiles-$arch/usr/share/icons/hicolor/${size}x${size}/apps"
convert SkEditorFiles-$arch/opt/SkEditor/SkEditor.png -resize ${size}x${size} "SkEditorFiles-$arch/usr/share/icons/hicolor/${size}x${size}/apps/SkEditor.png"
done
done
- name: πŸ“¦ | Download control scripts
run: |
for arch in x64 arm64; do
wget -O SkEditorFiles-$arch/DEBIAN/postrm 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/1eaea30df407c0e8f4b507dd4a0653dd20adc7eb/postrm'
wget -O SkEditorFiles-$arch/DEBIAN/preinst 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/1eaea30df407c0e8f4b507dd4a0653dd20adc7eb/preinst'
wget -O SkEditorFiles-$arch/DEBIAN/postinst 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/23e2c4503059777a10c78f54cbe87fa676bb94d2/postinst'
done
- name: πŸ”‘ | Fix Permissions
run: |
for arch in x64 arm64; do
chmod 0755 SkEditorFiles-$arch/DEBIAN/*
done
- name: πŸ“¦ | Create .deb package
run: |
cd /home/runner/work/SkEditor/SkEditor/
for arch in x64 arm64; do
dpkg-deb -Zgzip -b SkEditorFiles-$arch SkEditor-b${{ github.run_number }}-$arch.deb
done
- name: πŸ“€ | Upload artifacts
env:
TOKEN: ${{ secrets.APT_REPO_TOKEN }}
run: |
for arch in x64 arm64; do
curl --header "Authorization: Bearer ${TOKEN}" --form "package=@SkEditor-b${{ github.run_number }}-$arch.deb" --form "distribution=all" https://fixeq.baltorepo.com/skeditor/app/upload/
done
build-linux:
runs-on: ubuntu-latest
steps:
- name: πŸ“ | Checkout repository
uses: actions/checkout@v2
- name: πŸ“ | Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
- name: πŸ—οΈ | Build and publish for Linux
run: |
cd SkEditor
for arch in linux-x64 linux-arm64; do
dotnet restore
dotnet publish -c Release -r $arch -p:PublishSingleFile=true -p:PublishReadyToRun=true --no-self-contained /p:DebugType=None /p:DebugSymbols=false
done
- name: πŸ› οΈ | Create archive structure
run: |
mkdir -p "SkEditorFilesL/x64"
mkdir -p "SkEditorFilesL/arm64"
cp -r SkEditor/bin/Release/net8.0/linux-x64/publish/* "SkEditorFilesL/x64/"
cp -r SkEditor/bin/Release/net8.0/linux-arm64/publish/* "SkEditorFilesL/arm64/"
- name: πŸ“¦ | Pack SkEditor files
run: |
tar -czf SkEditor.tar.gz SkEditorFilesL/
- name: πŸ“€ | Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Linux (multiarch)
path: SkEditor.tar.gz