Skip to content

[Tech]: Created thumbnail component and new home page #41

[Tech]: Created thumbnail component and new home page

[Tech]: Created thumbnail component and new home page #41

name: Build and Deploy WASM Site
on:
push:
branches:
- main # Trigger the workflow on changes to the master branch
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history to ensure we can switch branches
# Step 3: Checkout main branch
- name: Switch to main branch
run: |
# Switch to the main branch
git fetch origin main
git checkout main
# Step 4: Set up .NET 8
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0' # Use .NET 8
- name: Install .NET WebAssembly Tools
run: dotnet workload install wasm-tools
# Step 5: Restore dependencies
- name: Restore dependencies
run: dotnet restore
# Step 6: Build the WASM project
- name: Build the WASM project
run: dotnet publish TestArena.sln -c:Release -o:build_output -p:GHPages=true
# Step 7: Debug - Verify build_output exists
- name: List build_output directory
run: |
echo "Checking build_output directory..."
ls -R build_output || echo "build_output directory does not exist!"
# Step 8: Deploy to github-pages-master branch
- name: Deploy to github-pages-master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use the GitHub-provided token
run: |
# Log the current GITHUB_WORKSPACE
echo "GITHUB_WORKSPACE is set to: $GITHUB_WORKSPACE"
# Ensure we're in the root of the repository
cd $GITHUB_WORKSPACE
# Switch to the github-pages-master branch
git fetch origin github-pages-master
git checkout -f github-pages-master
# Configure Git author identity
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
# Clean up old files and copy the new ones
cp -r build_output/wwwroot/* .
rm -rf build_output
rm -rf TestArena
# Commit and push changes
git add .
git status
git commit -m "Deploy updated WASM site" || echo "No changes to commit"
git push origin github-pages-master