From 45ee01cfb146b60d54cf9f687142f8870c247a97 Mon Sep 17 00:00:00 2001 From: kokolihapihvi <2726954+kokolihapihvi@users.noreply.github.com> Date: Sat, 7 Oct 2023 22:05:26 +0300 Subject: [PATCH] Implemented automatic build & release pipeline using GitHub Actions (#49) --- .github/workflows/ci.yml | 64 ++++++++++++++++++++++++++++++++++ RockSniffer/RockSniffer.csproj | 3 ++ RockSnifferLib | 2 +- Rocksmith2014PsarcLib | 2 +- 4 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8071328 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + id: build + run: | + VERSION=$(sed -nr 's/^.*const string version.*"(.*)".*$/\1/pi' ./RockSniffer/Program.cs) + echo "Sniffer version: $VERSION" + echo "SNIFFER_VERSION=$VERSION" >> "$GITHUB_OUTPUT" + dotnet build --configuration Release --no-restore + - name: Publish + env: + SNIFFER_VERSION: ${{ steps.build.outputs.SNIFFER_VERSION }} + run: | + dotnet publish RockSniffer -c Release -o ./publish --runtime win-x64 --framework=net6.0-windows --self-contained false -p:PublishSingleFile=true + cp -r ./addons ./publish/addons + (cd ./publish && zip -r "$OLDPWD/RockSniffer $SNIFFER_VERSION.zip" .) + echo "$SNIFFER_VERSION" > VERSION + - uses: actions/upload-artifact@v3 + with: + name: RockSniffer-release + path: | + VERSION + ./RockSniffer ${{ steps.build.outputs.SNIFFER_VERSION }}.zip + release: + runs-on: ubuntu-latest + needs: + - build + permissions: + contents: write + steps: + - uses: actions/download-artifact@v3 + with: + name: RockSniffer-release + - name: Get version + id: get-version + run: | + echo "SNIFFER_VERSION=$(cat VERSION)" >> "$GITHUB_OUTPUT" + - uses: ncipollo/release-action@v1 + with: + name: v${{ steps.get-version.outputs.SNIFFER_VERSION }} + tag: v${{ steps.get-version.outputs.SNIFFER_VERSION }} + allowUpdates: true + updateOnlyUnreleased: true + commit: ${{ github.sha }} + prerelease: true + draft: true + generateReleaseNotes: true + artifacts: "*.zip" \ No newline at end of file diff --git a/RockSniffer/RockSniffer.csproj b/RockSniffer/RockSniffer.csproj index 77f6870..22725a8 100644 --- a/RockSniffer/RockSniffer.csproj +++ b/RockSniffer/RockSniffer.csproj @@ -25,6 +25,9 @@ sniffy.ico + + none + diff --git a/RockSnifferLib b/RockSnifferLib index aed41a5..4f6c6d0 160000 --- a/RockSnifferLib +++ b/RockSnifferLib @@ -1 +1 @@ -Subproject commit aed41a54c13c1fa18e49f4f49652ff90aef2f5a3 +Subproject commit 4f6c6d0a799e2d990dba14c0ef6089c7c52fcf46 diff --git a/Rocksmith2014PsarcLib b/Rocksmith2014PsarcLib index 06a078a..8e21a35 160000 --- a/Rocksmith2014PsarcLib +++ b/Rocksmith2014PsarcLib @@ -1 +1 @@ -Subproject commit 06a078a872b7d9d8c0b7d0c58ca76543fdc095d4 +Subproject commit 8e21a35a0e1f7bdc09118e01ceaae09b62efc58d