Skip to content

Commit b081dc4

Browse files
committed
ci cleanup by notimaginative
1 parent f5a8e62 commit b081dc4

File tree

7 files changed

+84
-128
lines changed

7 files changed

+84
-128
lines changed

.github/workflows/build_release.yml

Lines changed: 32 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: windows-latest
2121
steps:
2222
- name: Checkout code
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2424
with:
2525
fetch-depth: 0
2626
ref: '${{ github.ref }}'
@@ -32,7 +32,7 @@ jobs:
3232
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
3333
3434
- name: Setup .NET
35-
uses: actions/setup-dotnet@v4
35+
uses: actions/setup-dotnet@v5
3636
with:
3737
dotnet-version: '6.0.x'
3838

@@ -53,7 +53,7 @@ jobs:
5353
tar -czvf win-builds.tgz --exclude='*.pdb' *
5454
5555
- name: Upload build archive
56-
uses: actions/upload-artifact@v4
56+
uses: actions/upload-artifact@v6
5757
with:
5858
name: win-builds
5959
path: ${{ env.PUBLISH_DIR }}/win-builds.tgz
@@ -64,7 +64,7 @@ jobs:
6464
runs-on: macos-latest
6565
steps:
6666
- name: Checkout code
67-
uses: actions/checkout@v4
67+
uses: actions/checkout@v5
6868
with:
6969
fetch-depth: 0
7070
ref: '${{ github.ref }}'
@@ -76,7 +76,7 @@ jobs:
7676
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
7777
7878
- name: Setup .NET
79-
uses: actions/setup-dotnet@v4
79+
uses: actions/setup-dotnet@v5
8080
with:
8181
dotnet-version: '6.0.x'
8282

@@ -97,18 +97,19 @@ jobs:
9797
tar -czvf mac-builds.tgz --exclude='*.pdb' *
9898
9999
- name: Upload build archive
100-
uses: actions/upload-artifact@v4
100+
uses: actions/upload-artifact@v6
101101
with:
102102
name: mac-builds
103103
path: ${{ env.PUBLISH_DIR }}/mac-builds.tgz
104104
retention-days: 5
105105

106-
build-android:
107-
name: Android build
106+
package_release:
107+
name: Linux/Android builds, package and release
108+
needs: [build-win, build-mac]
108109
runs-on: ubuntu-latest
109110
steps:
110111
- name: Checkout code
111-
uses: actions/checkout@v4
112+
uses: actions/checkout@v5
112113
with:
113114
fetch-depth: 0
114115
ref: '${{ github.ref }}'
@@ -119,13 +120,24 @@ jobs:
119120
echo "VERSION=$(echo ${{ github.ref_name }} | cut -c 2-)" >> $GITHUB_ENV
120121
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
121122
123+
- name: Create directories
124+
shell: bash
125+
run: |
126+
mkdir -p "$OUTPUT_DIR"
127+
mkdir -p "$PUBLISH_DIR"
128+
129+
- name: Install utilities
130+
# zip for packaging windows builds
131+
# nsis for windows installer
132+
run: sudo apt-get update && sudo apt-get install zip nsis
133+
122134
- name: Setup .NET 10
123-
uses: actions/setup-dotnet@v4
135+
uses: actions/setup-dotnet@v5
124136
with:
125137
dotnet-version: '10.0.x'
126138

127139
- name: Setup Java
128-
uses: actions/setup-java@v4
140+
uses: actions/setup-java@v5
129141
with:
130142
distribution: temurin
131143
java-version: '17'
@@ -136,81 +148,22 @@ jobs:
136148
dotnet workload install android
137149
dotnet workload list
138150
139-
- name: Build Android
140-
shell: bash
141-
run: |
142-
dotnet build Knossos.NET.Android/Knossos.NET.Android.csproj -c Release -p:BuildAndroid=true
143-
144-
- name: Collect Android artifacts
145-
shell: bash
146-
run: |
147-
mkdir -p "$OUTPUT_DIR/android"
148-
find . -type f \( -name "*-Signed.apk" -o -name "*.aab" \) -exec cp {} "$OUTPUT_DIR/android/" \;
149-
echo "Android artifacts collected:"
150-
ls -la "$OUTPUT_DIR/android"
151-
152-
- name: Upload Android artifacts
153-
uses: actions/upload-artifact@v4
154-
with:
155-
name: android-builds
156-
path: ${{ env.OUTPUT_DIR }}/android/*
157-
retention-days: 5
158-
159-
package_release:
160-
name: Linux builds, package and release
161-
needs: [build-win, build-mac, build-android]
162-
runs-on: ubuntu-latest
163-
steps:
164-
- name: Checkout code
165-
uses: actions/checkout@v4
166-
with:
167-
fetch-depth: 0
168-
ref: '${{ github.ref }}'
169-
170-
- name: Set environment
171-
shell: bash
172-
run: |
173-
echo "VERSION=$(echo ${{ github.ref_name }} | cut -c 2-)" >> $GITHUB_ENV
174-
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
175-
176-
- name: Create directories
177-
shell: bash
178-
run: |
179-
mkdir -p "$OUTPUT_DIR"
180-
mkdir -p "$PUBLISH_DIR"
181-
182-
- name: Install utilities
183-
# zip for packaging windows builds
184-
# nsis for windows installer
185-
run: sudo apt-get update && sudo apt-get install zip nsis
186-
187-
- name: Setup .NET
188-
uses: actions/setup-dotnet@v4
189-
with:
190-
dotnet-version: '6.0.x'
191-
192-
- name: Publish Linux RIDs
151+
- name: Publish Linux/Android RIDs
193152
shell: bash
194153
run: ./ci/publish_all_host.sh
195154

196155
- name: Download Windows build artifact
197-
uses: actions/download-artifact@v4
156+
uses: actions/download-artifact@v8
198157
with:
199158
name: win-builds
200159
path: ${{ env.PUBLISH_DIR }}
201160

202161
- name: Download macOS build artifact
203-
uses: actions/download-artifact@v4
162+
uses: actions/download-artifact@v8
204163
with:
205164
name: mac-builds
206165
path: ${{ env.PUBLISH_DIR }}
207166

208-
- name: Download Android build artifact
209-
uses: actions/download-artifact@v4
210-
with:
211-
name: android-builds
212-
path: ${{ env.OUTPUT_DIR }}/android
213-
214167
- name: Extract build archives
215168
run: |
216169
cd "$PUBLISH_DIR"
@@ -234,9 +187,10 @@ jobs:
234187
run: ${{ github.workspace }}/ci/create_appimage.sh
235188

236189
- name: Generate Release
237-
uses: softprops/action-gh-release@v2
238-
with:
239-
draft: true
240-
files: |
190+
env:
191+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
192+
run: |
193+
gh release create ${{ github.ref_name }} \
194+
--title "${{ github.ref_name }}" \
195+
--draft \
241196
${{ env.OUTPUT_DIR }}/*
242-
${{ env.OUTPUT_DIR }}/android/*

ci/create_appimage.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ install -m 755 "$FILE_ROOT/$APPRUN_FILE" "$APPDIR"
9898

9999
install -d "$APPDIR/usr/bin"
100100
tar -xzvf "$OUTPUT_DIR/Linux_$DOTNET_ARCH.tar.gz" -C "$APPDIR/usr/bin"
101-
BIN_NAME="${OUTPUT_BINARY_NAME:-$NAME}"
102-
chmod +x "$APPDIR/usr/bin/$BIN_NAME"
101+
chmod +x "$APPDIR/usr/bin/$NAME"
103102

104103
install -d "$APPDIR/usr/share/applications"
105104
install -m 644 "$BUILD_DIR/$ID.desktop" "$APPDIR/usr/share/applications"
@@ -124,4 +123,4 @@ ln -s "usr/share/icons/hicolor/256x256/apps/$ID.png" "$APPDIR"
124123
ARCH=$ARCH "$BUILD_DIR/appimagetool" -u "$UPDATE_SCHEME" "$APPDIR" "$OUTPUT_DIR/$NAME-$ARCH.AppImage"
125124

126125
# zsync file is saved to current directory so move it to proper place
127-
[ -f "$NAME-$ARCH.AppImage.zsync" ] && mv "$NAME-$ARCH.AppImage.zsync" "$OUTPUT_DIR"
126+
[ -f "$NAME-$ARCH.AppImage.zsync" ] && mv "$NAME-$ARCH.AppImage.zsync" "$OUTPUT_DIR"

ci/create_win_installer.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@ for arch in $ARCHS; do
4646
continue
4747
fi
4848

49-
BIN_NAME="${OUTPUT_BINARY_NAME:-$NAME}"
50-
51-
if [ ! -f "$PUBLISH_DIR/win-$arch/$BIN_NAME.exe" ]; then
52-
echo " $BIN_NAME binary for $arch not found! Skipping..."
53-
continue
54-
fi
49+
if [ ! -f "$PUBLISH_DIR/win-$arch/$NAME.exe" ]; then
50+
echo " $NAME binary for $arch not found! Skipping..."
51+
continue
52+
fi
5553

5654
if [ -n "$VERSION" ]; then
5755
makensis -DARCH=$arch -DVERSION="$VERSION" -DPUBLISH_DIR="$PUBLISH_DIR" -DOUTPUT_DIR="$OUTPUT_DIR" "packaging/windows/knossos.nsi"
@@ -62,4 +60,4 @@ done
6260

6361
echo
6462
echo "Done."
65-
echo
63+
echo

ci/package_all.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,21 @@ for rid in $RIDS; do
4343

4444
pushd "$PUBLISH_DIR/$rid" > /dev/null
4545

46-
BIN_NAME="${OUTPUT_BINARY_NAME:-$NAME}"
47-
48-
if [ ${rid:0:3} = "win" ]; then
49-
zip "$OUTPUT_DIR/$fname.zip" * -x \*.pdb
50-
else
51-
chmod +x "$BIN_NAME"
52-
tar -czvf "$OUTPUT_DIR/$fname.tar.gz" --exclude='*.pdb' *
53-
fi
46+
if [ ${rid:0:3} = "win" ]; then
47+
zip "$OUTPUT_DIR/$fname.zip" * -x \*.pdb
48+
elif [ $rid = "android" ]; then
49+
find . -maxdepth 1 -type f \( -name *-Signed.apk -o -name *.aab \) | while read file; do
50+
echo " copying: ${file:2}"
51+
cp -a "$file" "$OUTPUT_DIR"
52+
done
53+
else
54+
chmod +x "$NAME" # make sure binary is executable
55+
tar -czvf "$OUTPUT_DIR/$fname.tar.gz" --exclude='*.pdb' *
56+
fi
57+
5458
popd > /dev/null
5559
done
5660

5761
echo
5862
echo "Done."
59-
echo
63+
echo

ci/publish_all.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,22 @@ for rid in $RIDS; do
3030
echo "Publishing $rid ..."
3131
echo
3232

33-
dotnet publish "${PROJECT_FILE:="$NAME/$NAME.csproj"}" -r "$rid" -c Release -f net6.0 --self-contained -p:PublishSingleFile=true -o "$PUBLISH_DIR/$rid"
34-
35-
# Rename final executable to remove *.Desktop* from it
36-
if [ "${OUTPUT_BINARY_NAME:-$NAME}" != "${PROJECT_NAME:-$NAME}" ]; then
37-
if [[ "$rid" == win-* ]]; then
38-
[ -f "$PUBLISH_DIR/$rid/${PROJECT_NAME}.exe" ] && mv "$PUBLISH_DIR/$rid/${PROJECT_NAME}.exe" "$PUBLISH_DIR/$rid/${OUTPUT_BINARY_NAME}.exe"
39-
else
40-
[ -f "$PUBLISH_DIR/$rid/${PROJECT_NAME}" ] && mv "$PUBLISH_DIR/$rid/${PROJECT_NAME}" "$PUBLISH_DIR/$rid/${OUTPUT_BINARY_NAME}"
41-
chmod +x "$PUBLISH_DIR/$rid/${OUTPUT_BINARY_NAME}"
42-
fi
43-
fi
33+
if [ $rid = "android" ]; then
34+
PLATFORM=".Android"
35+
PLATFORM_FLAGS="-p:BuildAndroid=true"
36+
else
37+
PLATFORM=".Desktop"
38+
PLATFORM_FLAGS="-r \"$rid\" -f net6.0 --self-contained -p:PublishSingleFile=true -p:CheckEolTargetFramework=false"
39+
fi
40+
41+
dotnet publish "$NAME$PLATFORM/$NAME$PLATFORM.csproj" -c Release $PLATFORM_FLAGS -o "$PUBLISH_DIR/$rid"
42+
43+
# Rename final executable to remove platform descriptor from it
44+
find "$PUBLISH_DIR/$rid" -name "$NAME*" -not -iname \*.pdb | while read file; do
45+
mv -n "$file" "${file/$PLATFORM/}"
46+
done
4447
done
4548

4649
echo
4750
echo "Done."
48-
echo
51+
echo

ci/publish_all_host.sh

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,28 @@ esac
5555
for rid in $RIDS; do
5656
type="$(echo $rid | cut -d- -f1)"
5757
# if rid type doesn't match host then skip
58-
[ "$type" = "$host_rid" ] || continue
58+
[ "$type" = "$host_rid" ] || [ "$type" = "android" -a "$host_rid" = "linux" ] || continue
5959

6060
echo
6161
echo "Publishing $rid ..."
6262
echo
6363

64-
dotnet publish "${PROJECT_FILE:="$NAME/$NAME.csproj"}" -r "$rid" -c Release -f net6.0 --self-contained -p:PublishSingleFile=true -o "$PUBLISH_DIR/$rid"
65-
66-
# Rename final executable to remove *.Desktop* from it
67-
if [ "${OUTPUT_BINARY_NAME:-$NAME}" != "${PROJECT_NAME:-$NAME}" ]; then
68-
if [[ "$rid" == win-* ]]; then
69-
[ -f "$PUBLISH_DIR/$rid/${PROJECT_NAME}.exe" ] && mv "$PUBLISH_DIR/$rid/${PROJECT_NAME}.exe" "$PUBLISH_DIR/$rid/${OUTPUT_BINARY_NAME}.exe"
70-
else
71-
[ -f "$PUBLISH_DIR/$rid/${PROJECT_NAME}" ] && mv "$PUBLISH_DIR/$rid/${PROJECT_NAME}" "$PUBLISH_DIR/$rid/${OUTPUT_BINARY_NAME}"
72-
chmod +x "$PUBLISH_DIR/$rid/${OUTPUT_BINARY_NAME}"
73-
fi
74-
fi
64+
if [ $rid = "android" ]; then
65+
PLATFORM=".Android"
66+
PLATFORM_FLAGS="-p:BuildAndroid=true"
67+
else
68+
PLATFORM=".Desktop"
69+
PLATFORM_FLAGS="-r \"$rid\" -f net6.0 --self-contained -p:PublishSingleFile=true -p:CheckEolTargetFramework=false"
70+
fi
71+
72+
dotnet publish "$NAME$PLATFORM/$NAME$PLATFORM.csproj" -c Release $PLATFORM_FLAGS -o "$PUBLISH_DIR/$rid"
73+
74+
# Rename final executable to remove platform descriptor from it
75+
find "$PUBLISH_DIR/$rid" -name "$NAME*" -not -iname \*.pdb | while read file; do
76+
mv -n "$file" "${file/$PLATFORM/}"
77+
done
7578
done
7679

7780
echo
7881
echo "Done."
79-
echo
82+
echo

packaging/vars

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
NAME="Knossos.NET"
22
ID="io.github.knossosnet.Knossos_NET"
33
GITHUB_ORG="KnossosNET"
4-
RIDS="win-x86 win-x64 win-arm64 linux-x64 linux-arm64 osx-x64 osx-arm64"
5-
PROJECT_NAME="Knossos.NET.Desktop"
6-
PROJECT_FILE="$PROJECT_NAME/$PROJECT_NAME.csproj"
7-
OUTPUT_BINARY_NAME="Knossos.NET"
8-
ANDROID_PROJECT_NAME="Knossos.NET.Android"
9-
ANDROID_PROJECT_FILE="$ANDROID_PROJECT_NAME/$ANDROID_PROJECT_NAME.csproj"
4+
RIDS="win-x86 win-x64 win-arm64 linux-x64 linux-arm64 osx-x64 osx-arm64 android"

0 commit comments

Comments
 (0)