Update dotnet.yml #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Deploy and Publish Packages" | |
on: | |
release: | |
types: [released] | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code | |
- uses: actions/checkout@v2 | |
# Install .NET Core SDK | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.x | |
# Generate the website | |
- name: Install wasm tool | |
run: dotnet workload install wasm-tools | |
- name: Build and Test | |
run: | | |
dotnet build | |
dotnet test | |
- name : Set Version variable from tag | |
if: (github.event_name == 'release') | |
run: | | |
TAG=${{ github.event.release.tag_name }} | |
echo "VERSION=${TAG#v}" >> $GITHUB_ENV | |
- name: Pack NuGet Package | |
if: (github.event_name == 'release') | |
run: dotnet pack -c Release --include-symbols --include-source -p:PackageVersion=${VERSION} | |
- name: Publish NuGet Package | |
if: (github.event_name == 'release') | |
run: dotnet nuget push 'src/**/*.nupkg' -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate | |
# Generate the website | |
- name: Publish Sample Page | |
run: dotnet publish ./samples/BlazorTransitionGroup.Samples/BlazorTransitionGroup.Samples.csproj -c Release -f net8.0 -p:GHPages=true | |
# Deploy the site | |
- name: Deploy Github Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./samples/BlazorTransitionGroup.Samples/bin/Release/net8.0/publish/wwwroot | |
force_orphan: true | |