Skip to content

Test and Deploy

Test and Deploy #67

Workflow file for this run

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 }}