From 4bf7626346a39af5deb8d50ed5f9346c34246974 Mon Sep 17 00:00:00 2001 From: Webster Date: Thu, 7 Dec 2023 00:06:44 +0000 Subject: [PATCH] #19 package yaml version bumps --- .github/workflows/build.yml | 9 ++- .github/workflows/{main.yml => main.yml.back} | 0 .github/workflows/package.yml | 72 +++++++++++++++++++ .github/workflows/test.yml | 13 ++-- .../DataAccess.Repository.csproj | 2 +- 5 files changed, 89 insertions(+), 7 deletions(-) rename .github/workflows/{main.yml => main.yml.back} (100%) create mode 100644 .github/workflows/package.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9ec795d..690b842 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,11 @@ -name: Build actions +name: Branch - build branch actions -on: push +on: + push: + branches: + - '*' + - '!main' + - '!trunk' jobs: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml.back similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/main.yml.back diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..5ecf81b --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,72 @@ +name: Trunk - build and package actions + +on: + push: + branches: + - main + - trunk + +jobs: + + build_and_pack_DataAccess: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + # Install the .NET Core workload + - name: Install .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + # Set up local NuGet repo + - name: Setup GitHub NuGet + run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Ian-Webster/index.json" + + - name: Check for Changes in Repository Project + run: | + if [[ $(git diff --name-only ${{ github.event.before }} ${{ github.sha }} 'DataAccess.Repository/') ]]; then + echo "Changes detected in DataAccess.Repository project. Restoring packages and running build..." + dotnet restore 'DataAccess.Repository' + dotnet build --configuration Release 'DataAccess.Repository' + dotnet test 'DataAccess.Repository.Tests' + dotnet nuget push "DataAccess.Repository/bin/Release/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate + else + echo "No changes in DataAccess.Repository project. Skipping build and packing" + fi + + build_and_pack_HotChococlateExtension: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + # Install the .NET Core workload + - name: Install .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + # Set up local NuGet repo + - name: Setup GitHub NuGet + run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Ian-Webster/index.json" + + - name: Check for Changes in HotChocolate Project + run: | + if [[ $(git diff --name-only ${{ github.event.before }} ${{ github.sha }} 'Extensions/DataAccess.Repository.HotChocolate/') ]]; then + echo "Changes detected in Extensions/DataAccess.Repository.HotChocolate project. Restoring packages and running build..." + dotnet restore 'Extensions/DataAccess.Repository.HotChocolate' + dotnet build --configuration Release 'Extensions/DataAccess.Repository.HotChocolate' + dotnet nuget push "DataAccess.Repository/bin/Release/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate + else + echo "No changes in Extensions/DataAccess.Repository.HotChocolate project. Skipping build and packing" + fi \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8d5cb17..b49cda7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,11 @@ -name: Test DataAccess.Repository action +name: Branch - test DataAccess.Repository action -on: push +on: + push: + branches: + - '*' + - '!main' + - '!trunk' jobs: @@ -27,10 +32,10 @@ jobs: - name: Check for Changes in Repository Project run: | if [[ $(git diff --name-only ${{ github.event.before }} ${{ github.sha }} 'DataAccess.Repository/' 'DataAccess.Repository.Tests/') ]]; then - echo "Changes detected in DataAccess.Repository project. Restoring packages, running build and testing..." + echo "Changes detected. Restoring packages, running build and testing..." dotnet restore 'DataAccess.Repository' dotnet build --configuration Release 'DataAccess.Repository' dotnet test 'DataAccess.Repository.Tests' else - echo "No changes in DataAccess.Repository project. Skipping build." + echo "No changes. Skipping build and tests" fi \ No newline at end of file diff --git a/DataAccess.Repository/DataAccess.Repository.csproj b/DataAccess.Repository/DataAccess.Repository.csproj index d33a684..28ff22a 100644 --- a/DataAccess.Repository/DataAccess.Repository.csproj +++ b/DataAccess.Repository/DataAccess.Repository.csproj @@ -9,7 +9,7 @@ A simple base repository to be used in other projects requiring data access https://github.com/Ian-Webster/DataAccess https://github.com/Ian-Webster/DataAccess - 2.0.4 + 2.0.5