-
Notifications
You must be signed in to change notification settings - Fork 9
178 lines (158 loc) Β· 7.32 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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