From fd3c6aa62d8b5c24d297517f661849cf3be0340f Mon Sep 17 00:00:00 2001 From: "phnx47[bot]" <78849906+phnx47-bot@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:10:10 +0000 Subject: [PATCH] chore: synced local '.github/' with remote '.github/' --- .github/settings.yml | 2 +- .github/workflows/build.yml | 31 +++++++++++++++++-- .github/workflows/ci.yml | 61 ++++++------------------------------- 3 files changed, 38 insertions(+), 56 deletions(-) diff --git a/.github/settings.yml b/.github/settings.yml index 1ee6ee8..9633984 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -61,7 +61,7 @@ branches: required_pull_request_reviews: null required_status_checks: strict: false - contexts: ['Build & Test', 'Build & Test (Windows)'] + contexts: ['Build, Test & Pack'] enforce_admins: false required_linear_history: false restrictions: null diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a24bc39..7246b67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,12 +9,13 @@ on: jobs: build: - name: Build & Test + name: Build, Test & Pack runs-on: ubuntu-24.04 - steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup .NET uses: actions/setup-dotnet@v4 @@ -26,7 +27,7 @@ jobs: - name: Build run: dotnet build -c Release -p:ContinuousIntegrationBuild=true - - name: Run tests with Coverage + - name: Run tests run: dotnet test --no-build -c Release -p:CollectCoverage=true -e:CoverletOutputFormat=opencover - name: Publish to Codecov @@ -34,3 +35,27 @@ jobs: with: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + + - name: Set Dev version + if: github.ref == 'refs/heads/main' + run: | + version="$(git describe --long --tags | sed 's/^v//;0,/-/s//./')" + if [ -z "${version}" ]; then + version="0.0.0.$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)" + fi + echo "VERSION=${version}" >> $GITHUB_ENV + + - name: Set Release version + if: startsWith(github.ref, 'refs/tags/v') + run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV + + - name: Pack NuGet artifacts + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') + run: dotnet pack --no-build -c Release -p:PackageVersion="${{ env.VERSION }}" -o nupkgs + + - name: Upload artifacts + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') + uses: actions/upload-artifact@v4 + with: + name: nupkgs + path: nupkgs/**/*nupkg diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 193e7bb..ab6e7bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,52 +13,21 @@ jobs: uses: ./.github/workflows/build.yml secrets: inherit - pack: - name: Create NuGet packages - needs: [build] - runs-on: ubuntu-24.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set Dev version - if: github.ref == 'refs/heads/main' - run: | - version="$(git describe --long --tags | sed 's/^v//;0,/-/s//./')" - if [ -z "${version}" ]; then - version="0.0.0.$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)" - fi - echo "VERSION=${version}" >> $GITHUB_ENV - - - name: Set Release version - if: startsWith(github.ref, 'refs/tags/v') - run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV - - - name: Pack artifacts - run: dotnet pack -p:PackageVersion="${{ env.VERSION }}" -o packages - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: packages - path: packages/*nupkg - github: name: Deploy to GitHub - needs: [pack] + needs: [build] runs-on: ubuntu-24.04 steps: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: packages + name: nupkgs - name: Push to pkg.github.com - run: dotnet nuget push "*.nupkg" -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GH_FULL_PAT }} --skip-duplicate + run: dotnet nuget push "**/*.nupkg" -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GH_FULL_PAT }} --skip-duplicate - release: - name: Create GitHub release - needs: [pack] + nuget: + name: Deploy to NuGet + needs: [build] if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-24.04 steps: @@ -67,22 +36,10 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: packages - path: packages + name: nupkgs - name: Create GitHub Release - run: gh release create ${{ github.ref_name }} packages/*nupkg + run: gh release create ${{ github.ref_name }} **/*nupkg env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - nuget: - name: Deploy to NuGet - needs: [release] - if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-24.04 - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: packages - name: Push to nuget.org - run: dotnet nuget push "*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }} + run: dotnet nuget push "**/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_DEPLOY_KEY }}