Skip to content

Calendar border edits #57

Calendar border edits

Calendar border edits #57

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: 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: Run update-index-html.sh
# run: |
# INPUT_FILE=docs/index_src.html OUTPUT_FILE=docs/index.html bash /workspaces/hyper-cards/.devcontainer/update-index-html.sh
- 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