From 51b029f6a4c6f6e12b8ed7e00d01547c3b227827 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Tue, 17 Jun 2025 00:30:27 +0200 Subject: [PATCH] Compile to single binary --- WindowCapture.csproj | 4 ++++ release.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 release.sh diff --git a/WindowCapture.csproj b/WindowCapture.csproj index 88e2043..2261d39 100644 --- a/WindowCapture.csproj +++ b/WindowCapture.csproj @@ -4,6 +4,10 @@ net8.0 enable enable + true + true + win-x64 + true diff --git a/release.sh b/release.sh new file mode 100644 index 0000000..fc0026a --- /dev/null +++ b/release.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +echo "Figuring out the tag..." +TAG=$(git describe --tags --exact-match 2>/dev/null || echo "") +if [ -z "$TAG" ]; then + # Get the latest tag + LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) + # Increment the patch version + IFS='.' read -r -a VERSION_PARTS <<< "$LATEST_TAG" + VERSION_PARTS[2]=$((VERSION_PARTS[2]+1)) + TAG="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}" + # Create a new tag + git tag $TAG + git push origin $TAG +fi +echo "Tag: $TAG" + +echo "Building the thing..." +rm -rf bin obj +dotnet publish -c Release + +echo "Creating a release..." +TOKEN="$GITEA_API_KEY" +GITEA="https://git.site.quack-lab.dev" +REPO="dave/WindowCapture" +# Create a release +RELEASE_RESPONSE=$(curl -s -X POST \ + -H "Authorization: token $TOKEN" \ + -H "Accept: application/json" \ + -H "Content-Type: application/json" \ + -d '{ + "tag_name": "'"$TAG"'", + "name": "'"$TAG"'", + "draft": false, + "prerelease": false + }' \ + $GITEA/api/v1/repos/$REPO/releases) + +# Extract the release ID +echo $RELEASE_RESPONSE +RELEASE_ID=$(echo $RELEASE_RESPONSE | awk -F'"id":' '{print $2+0; exit}') +echo "Release ID: $RELEASE_ID" + +echo "Uploading the things..." +WINRELEASE="./bin/Release/net8.0/win-x64/publish/WindowCapture.exe" +curl -X POST \ + -H "Authorization: token $TOKEN" \ + -F "attachment=@$WINRELEASE" \ + "$GITEA/api/v1/repos/$REPO/releases/${RELEASE_ID}/assets?name=WindowCapture.exe" + +echo "Done!" \ No newline at end of file