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@v2 - uses: actions/setup-dotnet@v1 with: dotnet-version: "3.1.x" - uses: actions/setup-dotnet@v1 with: dotnet-version: "2.2.x" - uses: actions/setup-dotnet@v1 with: dotnet-version: "5.0.x" - name: Set RELEASE_VERSION run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: Restore Packages run: dotnet restore - 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 $RELEASE_VERSION 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.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/* hub release edit \ -a "SpotifyAPI.Web-netstandard2.0.zip" \ -a "SpotifyAPI.Web-netstandard2.1.zip" \ -a "SpotifyAPI.Web-net5.0.zip" \ -a "SpotifyAPI.Web.Auth-netstandard2.0.zip" \ -a "SpotifyAPI.Web.Auth-netstandard2.1.zip" \ -a "SpotifyAPI.Web.Auth-net5.0.zip" \ -m "" "$GITHUB_REF" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}