diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 344b57f..1ba6ca0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,30 +1,63 @@ -name: CI +name: CI/CD on: workflow_dispatch: push: branches: - - master + - main pull_request: types: [opened, synchronize, reopened] + release: + types: + - created jobs: - test: - name: Test + build: + name: Build, Test, and Deploy runs-on: windows-latest - defaults: - run: - working-directory: ./src steps: - name: ๐Ÿ›’ Checkout uses: actions/checkout@v2 - - name: โœจ Setup .NET 5 # CI: do not increase this + + - name: โœจ Setup .NET 5 uses: actions/setup-dotnet@v1 with: dotnet-version: "5.0.x" + + - name: โœจ Setup .NET 6 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: "6.0.x" + include-prerelease: true + - name: ๐Ÿšš Restore - run: dotnet restore + run: dotnet restore src + - name: ๐Ÿ› ๏ธ Build - run: dotnet build + run: dotnet build src --configuration Release --no-restore + - name: ๐Ÿงช Test - run: dotnet test + run: dotnet test src --configuration Release --no-build + + - name: ๐Ÿ“ฆ Pack + run: dotnet pack src --configuration Release --no-build + + - name: ๐Ÿ’พ Store Release Package + if: github.event_name == 'release' + uses: actions/upload-artifact@v2 + with: + name: Packages + retention-days: 1 + path: | + src/FftSharp/bin/Release/*.nupkg + src/FftSharp/bin/Release/*.snupkg + + - name: ๐Ÿ”‘ Configure NuGet Secrets + if: github.event_name == 'release' + uses: nuget/setup-nuget@v1 + with: + nuget-api-key: ${{ secrets.NUGET_API_KEY }} + + - name: ๐Ÿš€ Deploy Release Package + if: github.event_name == 'release' + run: nuget push "src\FftSharp\bin\Release\*.nupkg" -SkipDuplicate -Source https://api.nuget.org/v3/index.json diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 043c274..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Publish - -on: - workflow_dispatch: - release: - types: - - created - -jobs: - test: - name: Publish - runs-on: windows-latest - defaults: - run: - working-directory: ./src - steps: - - name: ๐Ÿ›’ Checkout - uses: actions/checkout@v2 - - name: โœจ Setup .NET 5 # CI: keep this for building and testing - uses: actions/setup-dotnet@v1 - with: - dotnet-version: "5.0.x" - - name: โœจ Setup .NET 6 # CI: keep this for packing - uses: actions/setup-dotnet@v1 - with: - dotnet-version: "6.0.x" - - name: ๐Ÿ› ๏ธ Setup NuGet - uses: nuget/setup-nuget@v1 - with: - nuget-api-key: ${{ secrets.NUGET_API_KEY }} - - name: ๐Ÿšš Restore - run: dotnet restore - - name: ๐Ÿ› ๏ธ Build - run: dotnet build --configuration Release - - name: ๐Ÿงช Test - run: dotnet test --configuration Release - - name: ๐Ÿ“ฆ Pack - run: dotnet pack --configuration Release - - name: ๐Ÿš€ Publish - run: nuget push "FftSharp\bin\Release\*.nupkg" -SkipDuplicate -Source https://api.nuget.org/v3/index.json