Merge pull request #95 from FixeQyt/patch-7 #176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-x64: | |
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 | |
dotnet restore | |
dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true -p:PublishReadyToRun=true --no-self-contained /p:DebugType=None /p:DebugSymbols=false | |
- name: π | Install Dependencies | |
run: | | |
sudo apt update | |
sudo apt install wget curl imagemagick -y | |
- name: π οΈ | Create .deb structure | |
run: | | |
mkdir -p "SkEditorFilesx/opt/SkEditor" | |
cp -r SkEditor/bin/Release/net8.0/linux-x64/publish/* "SkEditorFilesx/opt/SkEditor/" | |
mkdir -p "SkEditorFilesx/usr/share/applications" | |
wget -O SkEditorFilesx/usr/share/applications/SkEditor.desktop 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/ce4a0b2a782e73500aafde3ee24eb8ebf1194f98/SkEditor.desktop' | |
wget -O SkEditorFilesx/opt/SkEditor/SkEditor.png 'https://raw.githubusercontent.com/SkEditorTeam/SkEditor/main/SkEditor.png' | |
mkdir -p SkEditorFilesx/usr/share/mime/packages | |
wget -O SkEditorFilesx/usr/share/mime/packages/skript.xml 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/6d9cd730ecc86d8113b70b579627b11ff731ad6b/skript.xml' | |
mkdir -p "SkEditorFilesx/DEBIAN" | |
wget -O SkEditorFilesx/DEBIAN/control 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/98ca7ab3764efe4eee666878b76582b2ef37eb74/control' | |
- name: π | Extract version, measure size, and update control file | |
run: | | |
version=$(grep -oP '(?<=<InformationalVersion>).*?(?=</InformationalVersion>)' SkEditor/SkEditor.csproj) | |
size=$(du -s --block-size=K SkEditorFilesx/opt/SkEditor | cut -f1 | tr -d 'K') | |
echo "Version: $version-b${GITHUB_RUN_ID}" >> SkEditorFilesx/DEBIAN/control | |
echo "Version=$version" >> SkEditorFilesx/usr/share/applications/SkEditor.desktop | |
- name: π | Calculate MD5 and SHA256 checksums | |
run: | | |
cd SkEditorFilesx/ | |
find . -type f -not -path './DEBIAN/*' -exec md5sum {} + | sed 's| \./| |' > DEBIAN/md5sums | |
find . -type f -not -path './DEBIAN/*' -exec sha256sum {} + | sed 's| \./| |' > DEBIAN/sha256sums | |
- name: π¨ | Resize icon and create icon directories | |
run: | | |
sizes=(16 24 32 48 64 128 256) | |
for size in "${sizes[@]}"; do | |
mkdir -p "SkEditorFilesx/usr/share/icons/hicolor/${size}x${size}/apps" | |
convert SkEditorFilesx/opt/SkEditor/SkEditor.png -resize ${size}x${size} "SkEditorFilesx/usr/share/icons/hicolor/${size}x${size}/apps/SkEditor.png" | |
done | |
- name: π¦ | Download control scripts | |
run: | | |
wget -O SkEditorFilesx/DEBIAN/postrm 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/23e2c4503059777a10c78f54cbe87fa676bb94d2/postrm' | |
wget -O SkEditorFilesx/DEBIAN/preinst 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/23e2c4503059777a10c78f54cbe87fa676bb94d2/preinst' | |
wget -O SkEditorFilesx/DEBIAN/postinst 'https://gist.github.com/FixeQyt/8eb19f6f236c504ea86d873bd172113c/raw/23e2c4503059777a10c78f54cbe87fa676bb94d2/postinst' | |
- name: π | Fix Permissions | |
run: chmod 0755 SkEditorFilesx/DEBIAN/* | |
- name: π¦ | Create .deb package | |
run: | | |
cd /home/runner/work/SkEditor/SkEditor/ | |
dpkg-deb -Zgzip -b SkEditorFilesx SkEditor-x64.deb | |
- name: π€ | Upload artifacts | |
env: | |
TOKEN: ${{ secrets.APT_REPO_TOKEN }} | |
run: | | |
curl --header "Authorization: Bearer ${TOKEN}" --form "package=@SkEditor-x64.deb" --form "distribution=all" https://fixeq.baltorepo.com/skeditor/skeditor/upload/ | |
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 | |