Spotify.NET/.github/workflows/cicd.yaml
2022-11-27 13:30:39 +01:00

77 lines
2.7 KiB
YAML

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: "5.0.x"
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "7.0.x"
- 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.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.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/*
hub release edit \
-a "SpotifyAPI.Web-netstandard2.1.zip" \
-a "SpotifyAPI.Web-net5.0.zip" \
-a "SpotifyAPI.Web-net6.0.zip" \
-a "SpotifyAPI.Web-net7.0.zip" \
-a "SpotifyAPI.Web.Auth-netstandard2.1.zip" \
-a "SpotifyAPI.Web.Auth-net5.0.zip" \
-a "SpotifyAPI.Web.Auth-net6.0.zip" \
-a "SpotifyAPI.Web.Auth-net7.0.zip" \
-m "" "$RELEASE_VERSION"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}