Test and Deploy #70
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: Test and Deploy | |
env: | |
PUBLISH_DIR: Nodexr/bin/Release/net8.0/publish/wwwroot | |
# Controls when the action will run | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: Checkout ref (optional). | |
required: false | |
default: '' | |
type: string | |
skipTests: | |
description: Skip tests | |
required: false | |
default: false | |
type: boolean | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.ref }} | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Test | |
if: ${{ github.event.inputs.skipTests != 'true' }} | |
run: dotnet test Nodexr.Tests -c Release --no-restore | |
- name: Publish app | |
run: dotnet publish Nodexr -c Release --no-restore | |
- name: Rewrite base href | |
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1 | |
with: | |
html_path: ${{ env.PUBLISH_DIR }}/index.html | |
base_href: / | |
- name: GitHub Pages | |
if: success() && !env.ACT # Skip if testing with act | |
uses: crazy-max/[email protected] | |
with: | |
target_branch: gh-pages | |
build_dir: ${{ env.PUBLISH_DIR }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |