From 4167cb796705aa1a8a856a1273f8916afbe5b2ef Mon Sep 17 00:00:00 2001 From: KubaZ2 Date: Sat, 6 Jun 2026 15:08:17 +0200 Subject: [PATCH 1/4] Add GitHub releases --- .github/workflows/build-and-publish.yml | 26 ++++++++++++++++++++++++- .github/workflows/build.yml | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 96ee3621..9b503068 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -9,6 +9,8 @@ on: jobs: build-and-publish: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout @@ -42,7 +44,7 @@ jobs: dotnet pack NetCord -c Release --no-build dotnet pack NetCord.Services -c Release --no-build dotnet pack Hosting/NetCord.Hosting -c Release --no-build - dotnet pack Hosting/NetCord.Hosting.Services -c Release --no-build + dotnet pack Hosting/NetCord.Hosting.Services -c Release --no-build dotnet pack Hosting/NetCord.Hosting.AspNetCore -c Release --no-build - name: Setup docs environment @@ -81,6 +83,28 @@ jobs: strip_components: 2 target: ~/NetCord/html + - name: Create GitHub Release + env: + GH_TOKEN: ${{ github.token }} + run: | + cp -r Documentation/_site "Documentation-${{ github.ref_name }}" + + zip -r "Documentation-${{ github.ref_name }}.zip" "Documentation-${{ github.ref_name }}" + tar -czvf "Documentation-${{ github.ref_name }}.tar.gz" "Documentation-${{ github.ref_name }}" + + rm -r "Documentation-${{ github.ref_name }}" + + gh release create "${{ github.ref_name }}" \ + --generate-notes \ + --prerelease="${{ contains(github.ref_name, '-') }}" \ + NetCord/bin/Release/*.*nupkg \ + NetCord.Services/bin/Release/*.*nupkg \ + Hosting/NetCord.Hosting/bin/Release/*.*nupkg \ + Hosting/NetCord.Hosting.Services/bin/Release/*.*nupkg \ + Hosting/NetCord.Hosting.AspNetCore/bin/Release/*.*nupkg \ + "Documentation-${{ github.ref_name }}.zip" \ + "Documentation-${{ github.ref_name }}.tar.gz" + - name: Upload Build Artifacts uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 350387e0..a1ac8be9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,7 +49,7 @@ jobs: dotnet pack NetCord -c Release --no-build dotnet pack NetCord.Services -c Release --no-build dotnet pack Hosting/NetCord.Hosting -c Release --no-build - dotnet pack Hosting/NetCord.Hosting.Services -c Release --no-build + dotnet pack Hosting/NetCord.Hosting.Services -c Release --no-build dotnet pack Hosting/NetCord.Hosting.AspNetCore -c Release --no-build - name: Setup docs environment From 67ae08e9c380e17f778a81390c103d6dd4421864 Mon Sep 17 00:00:00 2001 From: KubaZ2 Date: Sat, 6 Jun 2026 15:23:27 +0200 Subject: [PATCH 2/4] Add release updating --- .github/workflows/build-and-publish.yml | 28 +++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 9b503068..3f28a1d5 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -94,16 +94,26 @@ jobs: rm -r "Documentation-${{ github.ref_name }}" - gh release create "${{ github.ref_name }}" \ - --generate-notes \ - --prerelease="${{ contains(github.ref_name, '-') }}" \ - NetCord/bin/Release/*.*nupkg \ - NetCord.Services/bin/Release/*.*nupkg \ - Hosting/NetCord.Hosting/bin/Release/*.*nupkg \ - Hosting/NetCord.Hosting.Services/bin/Release/*.*nupkg \ - Hosting/NetCord.Hosting.AspNetCore/bin/Release/*.*nupkg \ - "Documentation-${{ github.ref_name }}.zip" \ + FILES=( + NetCord/bin/Release/*.*nupkg + NetCord.Services/bin/Release/*.*nupkg + Hosting/NetCord.Hosting/bin/Release/*.*nupkg + Hosting/NetCord.Hosting.Services/bin/Release/*.*nupkg + Hosting/NetCord.Hosting.AspNetCore/bin/Release/*.*nupkg + "Documentation-${{ github.ref_name }}.zip" "Documentation-${{ github.ref_name }}.tar.gz" + ) + + if gh release view "${{ github.ref_name }}" >/dev/null 2>&1; then + gh release upload "${{ github.ref_name }}" \ + --clobber \ + "${FILES[@]}" + else + gh release create "${{ github.ref_name }}" \ + --generate-notes \ + --prerelease="${{ contains(github.ref_name, '-') }}" \ + "${FILES[@]}" + fi - name: Upload Build Artifacts uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 From 3c207c7d72cce828931fc7e114a328b0e71972d3 Mon Sep 17 00:00:00 2001 From: KubaZ2 Date: Sat, 6 Jun 2026 15:32:42 +0200 Subject: [PATCH 3/4] Use env --- .github/workflows/build-and-publish.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 3f28a1d5..2929db43 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -86,13 +86,15 @@ jobs: - name: Create GitHub Release env: GH_TOKEN: ${{ github.token }} + TAG: ${{ github.ref_name }} + IS_PRERELEASE: ${{ contains(github.ref_name, '-') }} run: | - cp -r Documentation/_site "Documentation-${{ github.ref_name }}" + cp -r Documentation/_site "Documentation-$TAG" - zip -r "Documentation-${{ github.ref_name }}.zip" "Documentation-${{ github.ref_name }}" - tar -czvf "Documentation-${{ github.ref_name }}.tar.gz" "Documentation-${{ github.ref_name }}" + zip -r "Documentation-$TAG.zip" "Documentation-$TAG" + tar -czvf "Documentation-$TAG.tar.gz" "Documentation-$TAG" - rm -r "Documentation-${{ github.ref_name }}" + rm -r "Documentation-$TAG" FILES=( NetCord/bin/Release/*.*nupkg @@ -100,8 +102,8 @@ jobs: Hosting/NetCord.Hosting/bin/Release/*.*nupkg Hosting/NetCord.Hosting.Services/bin/Release/*.*nupkg Hosting/NetCord.Hosting.AspNetCore/bin/Release/*.*nupkg - "Documentation-${{ github.ref_name }}.zip" - "Documentation-${{ github.ref_name }}.tar.gz" + "Documentation-$TAG.zip" + "Documentation-$TAG.tar.gz" ) if gh release view "${{ github.ref_name }}" >/dev/null 2>&1; then @@ -111,7 +113,7 @@ jobs: else gh release create "${{ github.ref_name }}" \ --generate-notes \ - --prerelease="${{ contains(github.ref_name, '-') }}" \ + --prerelease="$IS_PRERELEASE" \ "${FILES[@]}" fi From c7bf1f4d95d76eac56487fdbd7f3174d3cdb5755 Mon Sep 17 00:00:00 2001 From: KubaZ2 Date: Sat, 6 Jun 2026 15:38:01 +0200 Subject: [PATCH 4/4] Use env in commands --- .github/workflows/build-and-publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 2929db43..0ddb87db 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -106,12 +106,12 @@ jobs: "Documentation-$TAG.tar.gz" ) - if gh release view "${{ github.ref_name }}" >/dev/null 2>&1; then - gh release upload "${{ github.ref_name }}" \ + if gh release view "$TAG" >/dev/null 2>&1; then + gh release upload "$TAG" \ --clobber \ "${FILES[@]}" else - gh release create "${{ github.ref_name }}" \ + gh release create "$TAG" \ --generate-notes \ --prerelease="$IS_PRERELEASE" \ "${FILES[@]}"