name: Build/Test/Release SpotifyAPI-NET on: push: pull_request: jobs: spotifyapi-net-cicd: runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v4 - uses: actions/setup-dotnet@v3 with: dotnet-version: "5.x" - uses: actions/setup-dotnet@v3 with: dotnet-version: "6.x" - uses: actions/setup-dotnet@v3 with: dotnet-version: "7.0.203" - name: Set RELEASE_VERSION run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Restore Packages run: dotnet restore - name: Lint run: dotnet format --verify-no-changes - name: Build run: dotnet build --configuration Release --verbosity minimal - name: Test run: dotnet test SpotifyAPI.Web.Tests - name: Publish to NuGET run: ./publish.sh if: startsWith( github.ref, 'refs/tags/') env: NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} - name: Publish to GH Release uses: actions/create-release@v1 if: startsWith( github.ref, 'refs/tags/') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: SpotifyAPI Web ${{ github.ref }} body: | TODO draft: true prerelease: false - name: Upload to GH Release if: startsWith( github.ref, 'refs/tags/') run: | zip -j SpotifyAPI.Web-netstandard2.0.zip SpotifyAPI.Web/bin/Release/netstandard2.0/* zip -j SpotifyAPI.Web-netstandard2.1.zip SpotifyAPI.Web/bin/Release/netstandard2.1/* zip -j SpotifyAPI.Web-net5.0.zip SpotifyAPI.Web/bin/Release/net5.0/* zip -j SpotifyAPI.Web-net6.0.zip SpotifyAPI.Web/bin/Release/net6.0/* zip -j SpotifyAPI.Web-net7.0.zip SpotifyAPI.Web/bin/Release/net7.0/* zip -j SpotifyAPI.Web.Auth-netstandard2.0.zip SpotifyAPI.Web.Auth/bin/Release/netstandard2.0/* zip -j SpotifyAPI.Web.Auth-netstandard2.1.zip SpotifyAPI.Web.Auth/bin/Release/netstandard2.1/* zip -j SpotifyAPI.Web.Auth-net5.0.zip SpotifyAPI.Web.Auth/bin/Release/net5.0/* zip -j SpotifyAPI.Web.Auth-net6.0.zip SpotifyAPI.Web.Auth/bin/Release/net6.0/* zip -j SpotifyAPI.Web.Auth-net7.0.zip SpotifyAPI.Web.Auth/bin/Release/net7.0/* gh release upload "$RELEASE_VERSION" \ "SpotifyAPI.Web-netstandard2.0.zip" \ "SpotifyAPI.Web-netstandard2.1.zip" \ "SpotifyAPI.Web-net5.0.zip" \ "SpotifyAPI.Web-net6.0.zip" \ "SpotifyAPI.Web-net7.0.zip" \ "SpotifyAPI.Web.Auth-netstandard2.0.zip" \ "SpotifyAPI.Web.Auth-netstandard2.1.zip" \ "SpotifyAPI.Web.Auth-net5.0.zip" \ "SpotifyAPI.Web.Auth-net6.0.zip" \ "SpotifyAPI.Web.Auth-net7.0.zip" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}