From be2313e6a2e20293cf4e32878998909fe32f3591 Mon Sep 17 00:00:00 2001 From: Jhett Black <10942655+jhett12321@users.noreply.github.com> Date: Sun, 12 Jan 2025 02:19:49 +0100 Subject: [PATCH] Add github release stage. --- .github/workflows/ci.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd3e1b1..203752b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,11 +75,12 @@ jobs: path: NWNX.NET.Tests/bin/Release/NWNX.NET.Tests/results/*.xml build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' needs: [compile, test] outputs: version: ${{ steps.vars.outputs.VERSION }} + tag: ${{ steps.vars.outputs.TAG }} steps: - name: Checkout uses: actions/checkout@v4 @@ -108,6 +109,7 @@ jobs: id: vars run: | echo "VERSION=$(echo ${{ steps.bump_version.outputs.tag }} | sed 's/[v]//g')" >> "$GITHUB_OUTPUT" + echo "TAG=$(echo ${{ steps.bump_version.outputs.tag }})" >> "$GITHUB_OUTPUT" - name: Build Release Binaries id: build @@ -119,3 +121,25 @@ jobs: name: Binaries path: NWNX.NET/bin/Release if-no-files-found: error + + release: + runs-on: ubuntu-latest + if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' + needs: build + permissions: + contents: write + steps: + - name: Download Release Artifacts + uses: actions/download-artifact@v4 + with: + name: Binaries + path: binaries + + - name: Zip Binaries + run: zip -r ../NWNX.NET.zip ./* + working-directory: binaries + + - name: Upload Release Binaries + run: | + gh release create ${{ needs.build.outputs.tag }} --title "Release ${{ needs.build.outputs.version }}" + gh release upload ${{ needs.build.outputs.tag }} NWNX.NET.zip