From 30468b6268f044af07aa0a96ae889cfee47a6053 Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 03:41:08 +0300 Subject: [PATCH 01/11] Create build.yml --- .github/workflows/build.yml | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..18ed423 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: .NET + +on: [push, pull_request] + +env: + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_NOLOGO: true + DOTNET_SDK_VERSION: 8.0 + +jobs: + build: + strategy: + matrix: + configuration: [Release, Debug] + + name: Build and Package + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_SDK_VERSION }} + + - name: Verify .NET + run: dotnet --info + + - name: Restore dependencies + run: dotnet restore + + - name: Build project + run: dotnet build --no-restore -c "${{ matrix.configuration }}" -o "build/${{ matrix.configuration }}" + +# - name: Test changes +# run: dotnet test --no-build --verbosity normal + + - name: Build and Package Project + run: dotnet pack --include-source -c "${{ matrix.configuration }}" -o "build/nuget/${{ matrix.configuration }}" -p:Commit="${{ github.sha }}" + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + # Artifact name + name: ${{ github.event.repository.name }}-build-${{ matrix.configuration }}-${{ github.sha }} + + # A file, directory or wildcard pattern that describes what to upload + path: ./built/${{ matrix.configuration }} + retention-days: 90 + + - name: Upload a Nuget Artifact + uses: actions/upload-artifact@v4 + with: + # Artifact name + name: ${{ github.event.repository.name }}-nuget-${{ matrix.configuration }}-${{ github.sha }} + + # A file, directory or wildcard pattern that describes what to upload + path: ./built/nuget/${{ matrix.configuration }} + retention-days: 90 From 904ba848fa7f445bdb73cd6d6925247b3eac8f76 Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 03:45:11 +0300 Subject: [PATCH 02/11] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18ed423..9773e48 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,7 +51,7 @@ jobs: name: ${{ github.event.repository.name }}-build-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: ./built/${{ matrix.configuration }} + path: ${{ github.event.repository.name }}/built/${{ matrix.configuration }} retention-days: 90 - name: Upload a Nuget Artifact @@ -61,5 +61,5 @@ jobs: name: ${{ github.event.repository.name }}-nuget-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: ./built/nuget/${{ matrix.configuration }} + path: ${{ github.event.repository.name }}/built/nuget/${{ matrix.configuration }} retention-days: 90 From cf3b747ccdf891eba070814957c340ed72671c31 Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 03:46:58 +0300 Subject: [PATCH 03/11] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9773e48..01e6352 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,14 +51,14 @@ jobs: name: ${{ github.event.repository.name }}-build-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: ${{ github.event.repository.name }}/built/${{ matrix.configuration }} + path: ./${{ github.event.repository.name }}/built/${{ matrix.configuration }} retention-days: 90 - name: Upload a Nuget Artifact uses: actions/upload-artifact@v4 with: # Artifact name - name: ${{ github.event.repository.name }}-nuget-${{ matrix.configuration }}-${{ github.sha }} + name: ./${{ github.event.repository.name }}-nuget-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload path: ${{ github.event.repository.name }}/built/nuget/${{ matrix.configuration }} From 1cd7f3f7b8a17605b712e719c32ba2eddec4c9f7 Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 03:48:09 +0300 Subject: [PATCH 04/11] Update build.yml --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01e6352..ca66aa8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,15 +51,15 @@ jobs: name: ${{ github.event.repository.name }}-build-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: ./${{ github.event.repository.name }}/built/${{ matrix.configuration }} + path: ${{ github.event.repository.name }}/${{ github.event.repository.name }}/built/${{ matrix.configuration }} retention-days: 90 - name: Upload a Nuget Artifact uses: actions/upload-artifact@v4 with: # Artifact name - name: ./${{ github.event.repository.name }}-nuget-${{ matrix.configuration }}-${{ github.sha }} + name: ${{ github.event.repository.name }}-nuget-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: ${{ github.event.repository.name }}/built/nuget/${{ matrix.configuration }} + path: ${{ github.event.repository.name }}/${{ github.event.repository.name }}/built/nuget/${{ matrix.configuration }} retention-days: 90 From b1d3199c1d5d2e26abf267d39fb3e52160f397d6 Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 03:49:47 +0300 Subject: [PATCH 05/11] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ca66aa8..b4de887 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,7 +51,7 @@ jobs: name: ${{ github.event.repository.name }}-build-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: ${{ github.event.repository.name }}/${{ github.event.repository.name }}/built/${{ matrix.configuration }} + path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}/built/${{ matrix.configuration }} retention-days: 90 - name: Upload a Nuget Artifact @@ -61,5 +61,5 @@ jobs: name: ${{ github.event.repository.name }}-nuget-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: ${{ github.event.repository.name }}/${{ github.event.repository.name }}/built/nuget/${{ matrix.configuration }} + path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}/built/nuget/${{ matrix.configuration }} retention-days: 90 From 2627cf804fc1047f6c00d9af899e8effd3616697 Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 03:51:23 +0300 Subject: [PATCH 06/11] Update build.yml --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b4de887..90e57e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,9 @@ jobs: - name: Build and Package Project run: dotnet pack --include-source -c "${{ matrix.configuration }}" -o "build/nuget/${{ matrix.configuration }}" -p:Commit="${{ github.sha }}" + - name: List dir + run: ls + - name: Upload a Build Artifact uses: actions/upload-artifact@v4 with: From c399fc82a54985649802f012ec86466cc43d330d Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 03:53:01 +0300 Subject: [PATCH 07/11] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90e57e9..11364b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,7 @@ jobs: name: ${{ github.event.repository.name }}-build-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}/built/${{ matrix.configuration }} + path: built/${{ matrix.configuration }} retention-days: 90 - name: Upload a Nuget Artifact @@ -64,5 +64,5 @@ jobs: name: ${{ github.event.repository.name }}-nuget-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: ./${{ github.event.repository.name }}/${{ github.event.repository.name }}/built/nuget/${{ matrix.configuration }} + path: built/nuget/${{ matrix.configuration }} retention-days: 90 From 7b43937728c5607d3c98512ef73a07f3af5fe82a Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 03:54:35 +0300 Subject: [PATCH 08/11] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11364b4..254a5c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,7 @@ jobs: name: ${{ github.event.repository.name }}-build-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: built/${{ matrix.configuration }} + path: ./build/${{ matrix.configuration }} retention-days: 90 - name: Upload a Nuget Artifact @@ -64,5 +64,5 @@ jobs: name: ${{ github.event.repository.name }}-nuget-${{ matrix.configuration }}-${{ github.sha }} # A file, directory or wildcard pattern that describes what to upload - path: built/nuget/${{ matrix.configuration }} + path: ./build/nuget/${{ matrix.configuration }} retention-days: 90 From 75a0a6fdb4a2ddb1652cb913ebd1c8cc6219bbce Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 03:55:43 +0300 Subject: [PATCH 09/11] [ci skip] Update build.yml --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 254a5c8..aa7c324 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,9 +44,6 @@ jobs: - name: Build and Package Project run: dotnet pack --include-source -c "${{ matrix.configuration }}" -o "build/nuget/${{ matrix.configuration }}" -p:Commit="${{ github.sha }}" - - name: List dir - run: ls - - name: Upload a Build Artifact uses: actions/upload-artifact@v4 with: From 9d0c163315c67f8f32dee46f45d64b4c96090632 Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 04:47:13 +0300 Subject: [PATCH 10/11] Create release.yml --- .github/workflows/release.yml | 84 +++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..87591bc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,84 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: Release + +on: + release: + types: ["published"] + workflow_dispatch: + +env: + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_NOLOGO: true + DOTNET_SDK_VERSION: 8.0 + +jobs: + build: + strategy: + matrix: + configuration: [Release] + + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_SDK_VERSION }} + + - name: Verify .NET + run: dotnet --info + + - name: Restore dependencies + run: dotnet restore + + - name: Build project + run: dotnet build -c "${{ matrix.configuration }}" + +# - name: Test project +# run: dotnet test --no-build --verbosity normal + + package: + strategy: + matrix: + configuration: [Release] + + name: Package and Publish + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_SDK_VERSION }} + + - name: Build and Package Project + run: dotnet pack -c "${{ matrix.configuration }}" -o "build/${{ matrix.configuration }}" + + - name: Publish Nuget package to nuget.org + run: dotnet nuget push "build/${{ matrix.configuration }}/*" --skip-duplicate -k ${{ secrets.NUGET_ORG_API_KEY }} -s https://api.nuget.org/v3/index.json + + - name: Publish Nuget package to Github Packages + run: dotnet nuget push "build/${{ matrix.configuration }}/*" --skip-duplicate -k ${{ secrets.PAT_GITHUB }} -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v4 + with: + # Artifact name + name: ${{ github.event.repository.name }}-release-${{ matrix.configuration }}-${{ github.sha }} + + # A file, directory or wildcard pattern that describes what to upload + path: ./build/${{ matrix.configuration }} + retention-days: 90 From 9270fe0ad8c5cf684f35839f00ecacd4126c7313 Mon Sep 17 00:00:00 2001 From: fazelukario Date: Sat, 20 Apr 2024 04:52:53 +0300 Subject: [PATCH 11/11] [ci skip] Update release.yml --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87591bc..d19666b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,6 @@ name: Release on: release: types: ["published"] - workflow_dispatch: env: DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -64,6 +63,9 @@ jobs: with: dotnet-version: ${{ env.DOTNET_SDK_VERSION }} + - name: Verify .NET + run: dotnet --info + - name: Build and Package Project run: dotnet pack -c "${{ matrix.configuration }}" -o "build/${{ matrix.configuration }}"