Merge pull request #230 from jafin/feat/net8 #42
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: Build & Test Main | |
on: | |
push: | |
branches: [ main ] | |
release: | |
types: [ published ] | |
env: | |
NETCORE_VERSION: '8.0.x' | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
PROJECT_NAME: FluentValidation | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NUGET_FEED: https://api.nuget.org/v3/index.json | |
NUGET_KEY: ${{ secrets.NUGET_KEY }} | |
jobs: | |
build: | |
name: Build, test and pack | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup .NET Core ${{ env.NETCORE_VERSION }} | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.NETCORE_VERSION }} | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Restore | |
run: dotnet restore | |
- name: Build Fluent Validation | |
run: dotnet build -c Release --no-restore src/Blazored.$PROJECT_NAME/Blazored.$PROJECT_NAME.csproj | |
deploy: | |
needs: build | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ env.NETCORE_VERSION }} | |
- name: Create Release NuGet package | |
run: | | |
arrTag=(${GITHUB_REF//\// }) | |
VERSION="${arrTag[2]}" | |
echo Version: $VERSION | |
VERSION="${VERSION:1}" | |
echo Clean Version: $VERSION | |
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/Blazored.$PROJECT_NAME/Blazored.$PROJECT_NAME.csproj | |
- name: Push to NuGet Feed | |
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --api-key $NUGET_KEY --skip-duplicate | |
- name: Publish Sample Site | |
run: dotnet publish -c Release samples/BlazorWebAssembly/BlazorWebAssembly.csproj | |
- name: Rewrite base href | |
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1 | |
with: | |
html_path: samples/BlazorWebAssembly/bin/Release/net8.0/publish/wwwroot/index.html | |
base_href: /${{ env.PROJECT_NAME }}/ | |
- name: Deploy to Github Pages | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
ACCESS_TOKEN: $GITHUB_TOKEN | |
BASE_BRANCH: main # The branch the action should deploy from. | |
BRANCH: gh-pages # The branch the action should deploy to. | |
FOLDER: samples/BlazorWebAssembly/bin/Release/net8.0/publish/wwwroot # The folder the action should deploy. | |
SINGLE_COMMIT: true |