-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9aa211b
commit a00f1ba
Showing
10 changed files
with
314 additions
and
166 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Use the official .NET SDK image | ||
FROM mcr.microsoft.com/devcontainers/dotnet:1-9.0 AS base | ||
|
||
# Install additional tools if needed | ||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
curl \ | ||
&& apt-get clean | ||
|
||
# Install Node.js (using NodeSource) | ||
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ | ||
&& apt-get install -y nodejs \ | ||
&& npm install -g @azure/static-web-apps-cli | ||
|
||
# Install PowerShell | ||
RUN apt-get update && apt-get install -y \ | ||
powershell \ | ||
&& apt-get clean | ||
|
||
# Add the script to update the HTML file | ||
COPY update-index-html.sh /usr/local/bin/update-index-html.sh | ||
RUN chmod +x /usr/local/bin/update-index-html.sh | ||
|
||
# Set up a non-root user | ||
ARG USERNAME=vscode | ||
RUN id -u $USERNAME &>/dev/null || useradd -m $USERNAME | ||
USER $USERNAME |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet | ||
{ | ||
"name": "C# and Blazor Dev Container", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "bash" | ||
} | ||
}, | ||
"extensions": [ | ||
"ms-dotnettools.csharp", // C# support | ||
"eamodio.gitlens", // GitLens for git insights | ||
"ms-vscode.vscode-typescript-next" // Optional for JS/TS in Blazor | ||
] | ||
}, | ||
"postCreateCommand": "dotnet restore && /usr/local/bin/update-index-html.sh", // Restore NuGet packages | ||
"remoteUser": "vscode" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
INPUT_FILE="/workspaces/hyper-cards/Client/wwwroot/index_src.html" | ||
OUTPUT_FILE="/workspaces/hyper-cards/Client/wwwroot/index.html" | ||
|
||
# Generate a new GUID | ||
GUID=$(uuidgen) | ||
|
||
# Read the content of the input file | ||
CONTENT=$(cat $INPUT_FILE) | ||
|
||
# Replace the placeholder with the new GUID | ||
UPDATED_CONTENT=${CONTENT//dynamic-guid/$GUID} | ||
|
||
# Write the updated content to the output file | ||
echo "$UPDATED_CONTENT" > $OUTPUT_FILE |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,80 @@ | ||
name: Sync wwwroot to GitHubPages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Trigger on changes to the main branch | ||
|
||
env: | ||
TARGET_BRANCH: GitHubPages # Branch to push to | ||
SUBFOLDER_PATH: Client/bin/Release/net9.0/publish/wwwroot # Path of the subfolder to copy | ||
GIT_USER_NAME: "github-actions[bot]" # GitHub Actions bot username | ||
GIT_USER_EMAIL: "github-actions[bot]@users.noreply.github.com" # GitHub Actions bot email | ||
BASE_COMMIT_MESSAGE: "wwwroot sync from main" | ||
OUTPUT_FOLDER: docs | ||
OUTPUT_FOLDER_TEMP: ../OUTPUT_FOLDER_TEMP | ||
|
||
jobs: | ||
sync-wwwroot-to-GitHubPages: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout main branch | ||
uses: actions/checkout@v4 # Update to the latest version to avoid Node.js deprecation warning | ||
with: | ||
fetch-depth: 0 # Fetch all history so we can switch branches later | ||
|
||
- name: Setup .NET 9 SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '9.0.x' | ||
|
||
- name: Restore and build/publish the project | ||
run: | | ||
dotnet restore | ||
dotnet publish -c Release | ||
- name: Copy subfolder to a temporary directory | ||
run: | | ||
mkdir -p $OUTPUT_FOLDER_TEMP | ||
cp -R $SUBFOLDER_PATH/* $OUTPUT_FOLDER_TEMP/ # Use the variable for the subfolder path | ||
- name: Checkout and reset target branch | ||
run: | | ||
git config --global pull.rebase true | ||
git config user.name "$GIT_USER_NAME" | ||
git config user.email "$GIT_USER_EMAIL" | ||
git stash push --include-untracked -m "Stashing all changes" | ||
git fetch origin $TARGET_BRANCH | ||
git checkout -B $TARGET_BRANCH origin/$TARGET_BRANCH | ||
git reset --hard origin/$TARGET_BRANCH | ||
rm -rf .github/* | ||
rm -rf .gitignore | ||
rm -rf * | ||
- name: Move Subfolder to Target Branch | ||
run: | | ||
mkdir -p $OUTPUT_FOLDER | ||
cp -R $OUTPUT_FOLDER_TEMP/* $OUTPUT_FOLDER | ||
rm -rf $OUTPUT_FOLDER_TEMP | ||
touch $OUTPUT_FOLDER/.nojekyll | ||
- name: Generate Commit Message with Date-Time | ||
id: commit_message # Set an ID to reference this step's outputs | ||
run: echo "COMMIT_MESSAGE=$BASE_COMMIT_MESSAGE $(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV | ||
|
||
- name: Commit and push changes | ||
run: | | ||
git add . | ||
git commit -m "$COMMIT_MESSAGE" # Use the dynamic commit message | ||
git push -f origin $TARGET_BRANCH # Force push to overwrite the target branch | ||
name: Sync wwwroot to GitHubPages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Trigger on changes to the main branch | ||
|
||
env: | ||
TARGET_BRANCH: GitHubPages # Branch to push to | ||
SUBFOLDER_PATH: Client/bin/Release/net9.0/publish/wwwroot # Path of the subfolder to copy | ||
GIT_USER_NAME: "github-actions[bot]" # GitHub Actions bot username | ||
GIT_USER_EMAIL: "github-actions[bot]@users.noreply.github.com" # GitHub Actions bot email | ||
BASE_COMMIT_MESSAGE: "wwwroot sync from main" | ||
OUTPUT_FOLDER: docs | ||
OUTPUT_FOLDER_TEMP: ../OUTPUT_FOLDER_TEMP | ||
|
||
jobs: | ||
sync-wwwroot-to-GitHubPages: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout main branch | ||
uses: actions/checkout@v4 # Update to the latest version to avoid Node.js deprecation warning | ||
with: | ||
fetch-depth: 0 # Fetch all history so we can switch branches later | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build Docker image | ||
run: docker build -t hyper-cards-devcontainer -f .devcontainer/Dockerfile . | ||
|
||
- name: Run update-index-html.sh | ||
run: docker run --rm -v ${{ github.workspace }}:/workspace hyper-cards-devcontainer /usr/local/bin/update-index-html.sh | ||
|
||
- name: Setup .NET 9 SDK | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '9.0.x' | ||
|
||
- name: Restore and build/publish the project | ||
run: | | ||
dotnet restore | ||
dotnet publish -c Release | ||
- name: Copy subfolder to a temporary directory | ||
run: | | ||
mkdir -p $OUTPUT_FOLDER_TEMP | ||
cp -R $SUBFOLDER_PATH/* $OUTPUT_FOLDER_TEMP/ # Use the variable for the subfolder path | ||
- name: Checkout and reset target branch | ||
run: | | ||
git config --global pull.rebase true | ||
git config user.name "$GIT_USER_NAME" | ||
git config user.email "$GIT_USER_EMAIL" | ||
git stash push --include-untracked -m "Stashing all changes" | ||
git fetch origin $TARGET_BRANCH | ||
git checkout -B $TARGET_BRANCH origin/$TARGET_BRANCH | ||
git reset --hard origin/$TARGET_BRANCH | ||
rm -rf .github/* | ||
rm -rf .gitignore | ||
rm -rf * | ||
- name: Move Subfolder to Target Branch | ||
run: | | ||
mkdir -p $OUTPUT_FOLDER | ||
cp -R $OUTPUT_FOLDER_TEMP/* $OUTPUT_FOLDER | ||
rm -rf $OUTPUT_FOLDER_TEMP | ||
touch $OUTPUT_FOLDER/.nojekyll | ||
- name: Generate Commit Message with Date-Time | ||
id: commit_message # Set an ID to reference this step's outputs | ||
run: echo "COMMIT_MESSAGE=$BASE_COMMIT_MESSAGE $(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV | ||
|
||
- name: Commit and push changes | ||
run: | | ||
git add . | ||
git commit -m "$COMMIT_MESSAGE" # Use the dynamic commit message | ||
git push -f origin $TARGET_BRANCH # Force push to overwrite the target branch |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch and Debug Standalone Blazor WebAssembly App", | ||
"type": "blazorwasm", | ||
"request": "launch", | ||
"cwd": "${workspaceFolder}/Client" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"build", | ||
"${workspaceFolder}/hyper-cards.sln", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary;ForceNoAlign" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "publish", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"publish", | ||
"${workspaceFolder}/hyper-cards.sln", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary;ForceNoAlign" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "watch", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"watch", | ||
"run", | ||
"--project", | ||
"${workspaceFolder}/hyper-cards.sln" | ||
], | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<RootNamespace>HyperCards.Client</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.Build.Framework" Version="17.12.6" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Shared\Shared.csproj" /> | ||
</ItemGroup> | ||
|
||
<Target Name="UpdateIndexHtml" BeforeTargets="Build"> | ||
<Exec Command="pwsh -ExecutionPolicy Bypass -File UpdateIndexHtml.ps1 -InputFile wwwroot/index_src.html -OutputFile wwwroot/index.html" /> | ||
</Target> | ||
|
||
<Target Name="PostPublish" AfterTargets="Publish"> | ||
<Exec Command="rm $(PublishDir)wwwroot/index_src.html" /> | ||
<Exec Command="mkdir -p $(PublishDir)wwwroot/calendar" /> | ||
<Exec Command="mkdir -p $(PublishDir)wwwroot/notes" /> | ||
<Exec Command="mkdir -p $(PublishDir)wwwroot/todo" /> | ||
<Exec Command="cp $(PublishDir)wwwroot/index.html $(PublishDir)wwwroot/calendar/index.html" /> | ||
<Exec Command="cp $(PublishDir)wwwroot/index.html $(PublishDir)wwwroot/notes/index.html" /> | ||
<Exec Command="cp $(PublishDir)wwwroot/index.html $(PublishDir)wwwroot/todo/index.html" /> | ||
</Target> | ||
|
||
</Project> | ||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<RootNamespace>HyperCards.Client</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" /> | ||
<PackageReference Include="Microsoft.Build.Framework" Version="17.12.6" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Shared\Shared.csproj" /> | ||
</ItemGroup> | ||
|
||
<Target Name="PostPublish" AfterTargets="Publish"> | ||
<Exec Command="rm $(PublishDir)wwwroot/index_src.html" /> | ||
<Exec Command="mkdir -p $(PublishDir)wwwroot/calendar" /> | ||
<Exec Command="mkdir -p $(PublishDir)wwwroot/notes" /> | ||
<Exec Command="mkdir -p $(PublishDir)wwwroot/todo" /> | ||
<Exec Command="cp $(PublishDir)wwwroot/index.html $(PublishDir)wwwroot/calendar/index.html" /> | ||
<Exec Command="cp $(PublishDir)wwwroot/index.html $(PublishDir)wwwroot/notes/index.html" /> | ||
<Exec Command="cp $(PublishDir)wwwroot/index.html $(PublishDir)wwwroot/todo/index.html" /> | ||
</Target> | ||
|
||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,26 @@ | ||
@page "/" | ||
|
||
<PageTitle>HyperCards.io</PageTitle> | ||
|
||
<h1>HyperCards.io</h1> | ||
@page "/" | ||
|
||
<PageTitle>HyperCards.io</PageTitle> | ||
|
||
<h1>HyperCards.io</h1> | ||
|
||
<card> | ||
Hello, this is the personal coding playground of <a href="https://www.linkedin.com/in/mdtanner/" target="_blank">Michael Tanner</a>. | ||
<br /> | ||
<br /> | ||
This site is built with Microsoft Blazor, a framework for building interactive web apps using C# and HTML for running in the browser via Webassembly. | ||
<br /> | ||
<br /> | ||
HyperCards.io is statically hosted using GitHub Pages. | ||
<br /> | ||
See the source code here: | ||
<br /> | ||
<ul> | ||
<li><a href="https://github.com/michael-tanner/hyper-cards" target="_blank">https://github.com/michael-tanner/hyper-cards</a></li> | ||
<li><a href="https://github.com/michael-tanner/hyper-cards/tree/GitHubPages/docs" target="_blank">https://github.com/michael-tanner/hyper-cards/tree/GitHubPages/docs</a></li> | ||
</ul> | ||
All interactive portions of this site use your browser's local storage to save your data. | ||
<br /> | ||
<br /> | ||
None of your data is sent to a server. | ||
</card> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.