From 73d2131c738df8fc64ce1421dd35ab9baadfb9f1 Mon Sep 17 00:00:00 2001 From: dkeruza-neo Date: Wed, 1 Oct 2025 17:27:51 -0400 Subject: [PATCH] Added Discord bot. And a small fix. --- .github/workflows/appimage-build.yml | 17 ++++++ .github/workflows/main.yml | 91 +++++++++++++++++++--------- docs/changelog | 2 + scripts/appimage/install-kisak.sh | 3 + scripts/flatpak/.gitignore | 1 - src/lindbergh/resolution.c | 3 +- 6 files changed, 84 insertions(+), 33 deletions(-) diff --git a/.github/workflows/appimage-build.yml b/.github/workflows/appimage-build.yml index b8389b7..f90b9ee 100644 --- a/.github/workflows/appimage-build.yml +++ b/.github/workflows/appimage-build.yml @@ -18,6 +18,14 @@ jobs: name: version-file path: src/lindbergh/ + - name: Cache APT packages + uses: actions/cache@v4 + with: + path: /var/cache/apt/archives + key: ${{ runner.os }}-apt-${{ hashFiles('**/install-packages.sh') }} + restore-keys: | + ${{ runner.os }}-apt- + - name: Install Packages run: scripts/appimage/install-packages.sh @@ -39,6 +47,15 @@ jobs: make scripts/appimage/make-appimage.sh + - name: Compress build directory + run: tar -czvf build.tar.gz -C ./build . + + - name: Upload build.tar.gz artifact + uses: actions/upload-artifact@v4 + with: + name: "linux-build" + path: "build.tar.gz" + - name: Upload AppImage uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61920b4..e347c5e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,41 +33,30 @@ jobs: run: | CHANGELOG_FILE="./docs/changelog" VERSION_FILE="src/lindbergh/version.h" - if [[ ! -f "$CHANGELOG_FILE" ]]; then echo "Error: Changelog file '$CHANGELOG_FILE' not found." exit 1 fi - VERSION=$(awk '/^## \[/ { match($0, /\[([^]]+)\]/, arr); print arr[1]; exit }' "$CHANGELOG_FILE") - - # Check if a version was actually extracted if [[ -z "$VERSION" ]]; then echo "Error: Could not find version in '$CHANGELOG_FILE'. Expected format like '## [X.Y.Z]' near the top." exit 1 fi - echo "Found version: $VERSION" - MAJOR=$(echo $VERSION | cut -d. -f1) MINOR=$(echo $VERSION | cut -d. -f2) UPDATE=$(echo $VERSION | cut -d. -f3) - if [ -z "$UPDATE" ]; then UPDATE=0 fi - if [[ ! -f "$VERSION_FILE" ]]; then echo "Error: Version file '$VERSION_FILE' not found." exit 1 fi - sed -i "s/\(#define MAJOR_VERSION \).*/\1$MAJOR/" "$VERSION_FILE" sed -i "s/\(#define MINOR_VERSION \).*/\1$MINOR/" "$VERSION_FILE" sed -i "s/\(#define UPDATE_VERSION \).*/\1$UPDATE/" "$VERSION_FILE" - echo "Updated $VERSION_FILE with version $MAJOR.$MINOR.$UPDATE" - echo "RELEASE_VERSION=$VERSION" >> $GITHUB_OUTPUT echo "RELEASE_TAG=v$VERSION" >> $GITHUB_OUTPUT @@ -82,21 +71,15 @@ jobs: needs: prepare-source uses: "./.github/workflows/appimage-build.yml" - linux-build: - name: 💻 Linux - needs: [prepare-source, linux-appimage] - uses: "./.github/workflows/linux-build.yml" - linux-flatpak: name: 📦 Linux Flatpak needs: [prepare-source, linux-appimage] uses: "./.github/workflows/flatpak-build.yml" create-release: - name: 📤 Create Release - needs: [linux-build, linux-flatpak, linux-appimage, prepare-source] + name: 📤 Create Release and Notify + needs: [linux-flatpak, linux-appimage, prepare-source] runs-on: ubuntu-22.04 - if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - name: Checkout code uses: actions/checkout@v4 @@ -107,18 +90,66 @@ jobs: uses: actions/download-artifact@v4 with: path: ./artifacts/ - + - name: Display Downloaded Artifacts run: find ./artifacts/ - - name: Create Release - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: ${{ needs.prepare-source.outputs.release_tag }} - prerelease: false - title: "Build ${{ needs.prepare-source.outputs.release_tag }}" - files: | + - name: Parse Changelog and Save to File + id: changelog + run: | + VERSION='${{ needs.prepare-source.outputs.release_version }}' + awk -v version="$VERSION" ' + $0 ~ "^## \\[" version "\\]" { in_section=1; next } + /^## / && in_section { exit } + in_section { print } + ' ./docs/changelog > RELEASENOTES.md + echo "notes_file=RELEASENOTES.md" >> $GITHUB_OUTPUT + + + - name: Create Release with GitHub CLI + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create ${{ needs.prepare-source.outputs.release_tag }} \ + --title "Build ${{ needs.prepare-source.outputs.release_tag }}" \ + --notes-file ${{ steps.changelog.outputs.notes_file }} \ + ./artifacts/linux-build/build.tar.gz \ + ./artifacts/linux-appimage/lindbergh-loader.AppImage \ ./artifacts/linux-flatpak/lindbergh-loader.flatpak - ./artifacts/linux-build/build.tar.gz - ./artifacts/linux-appimage/lindbergh-loader.AppImage + + - name: Notify Discord of New Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Fetch the asset details + ASSETS_JSON=$(gh release view ${{ needs.prepare-source.outputs.release_tag }} --json assets) + + # Extract each URL + FLATPAK_URL=$(echo "$ASSETS_JSON" | jq -r '.assets[] | select(.name=="lindbergh-loader.flatpak") | .url') + APPIMAGE_URL=$(echo "$ASSETS_JSON" | jq -r '.assets[] | select(.name=="lindbergh-loader.AppImage") | .url') + TAR_URL=$(echo "$ASSETS_JSON" | jq -r '.assets[] | select(.name=="build.tar.gz") | .url') + + # Get the changelog body (no need to escape it for jq) + CHANGELOG_BODY=$(cat ${{ steps.changelog.outputs.notes_file }} | head -c 2000) + + # Use jq to build the JSON payload and pipe it to curl + jq -n \ + --arg content "New lindbergh loader development build **v${{ needs.prepare-source.outputs.release_version }}** has been released!" \ + --arg changelog "$CHANGELOG_BODY" \ + --arg flatpak_url "$FLATPAK_URL" \ + --arg appimage_url "$APPIMAGE_URL" \ + --arg tar_url "$TAR_URL" \ + '{ + "username": "Build Bot", + "content": $content, + "embeds": [{ + "description": $changelog, + "color": 5814783, + "fields": [ + { + "name": "Downloads", + "value": "[Flatpak](\($flatpak_url))\n[AppImage](\($appimage_url))\n[Build Tarball](\($tar_url))" + } + ] + }] + }' | curl -X POST -H "Content-Type: application/json" -d @- "${{ secrets.DISCORD_WEBHOOK_URL }}" \ No newline at end of file diff --git a/docs/changelog b/docs/changelog index 228fe37..3246b44 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## [2.1.1] ### Added + - HOD4 Boss battle targets should be fine now. + - Discord Bot. - Zink support in appimage (fixes Zink in the Steam Deck). - Change the Mesa version on the fly to fix ID games rendering issues in the appimage. ### Fixed diff --git a/scripts/appimage/install-kisak.sh b/scripts/appimage/install-kisak.sh index 433682e..f7a1158 100755 --- a/scripts/appimage/install-kisak.sh +++ b/scripts/appimage/install-kisak.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +sudo snap refresh --hold=forever +sudo apt-mark hold linux-image-$(uname -r) +sudo apt-mark hold linux-headers-$(uname -r) sudo add-apt-repository ppa:kisak/turtle -y sudo apt update -y && sudo apt upgrade -y \ No newline at end of file diff --git a/scripts/flatpak/.gitignore b/scripts/flatpak/.gitignore index 32e56d7..60b1a16 100644 --- a/scripts/flatpak/.gitignore +++ b/scripts/flatpak/.gitignore @@ -1,5 +1,4 @@ .flatpak-builder/ build/ repo/ -assets/lib32ID *.flatpak diff --git a/src/lindbergh/resolution.c b/src/lindbergh/resolution.c index ca554a9..a296bf1 100644 --- a/src/lindbergh/resolution.c +++ b/src/lindbergh/resolution.c @@ -1127,7 +1127,7 @@ void glVertex3fHOD4(GLfloat x, GLfloat y, GLfloat z) else if (z == -1.510000f) { // logo 2d elemtents target - if (curTextureID != 262) // target boss fight // Added 2 because of the crosshairs. + if (curTextureID != 260) // target boss fight // Added 2 because of the crosshairs. { x += OffsetX; y -= OffsetY; @@ -1218,7 +1218,6 @@ void glVertex3fHOD4(GLfloat x, GLfloat y, GLfloat z) } else { - if (curTextureID != 26) { // gun effect if (z > -1.8f && z < -1.0f)