Skip to content

useless ls deleted from the action #5

useless ls deleted from the action

useless ls deleted from the action #5

Workflow file for this run

on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code from the main branch
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Set up Rust
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
# Step 3: Run the Rust program to generate files in the 'output' folder
- name: Run Rust program
run: cargo run --release
# Step 4: Switch to 'gh-pages' branch and clean old content
- name: Deploy to GitHub Pages
run: |
# Configure git
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Create or checkout the 'gh-pages' branch
git fetch origin gh-pages
git checkout gh-pages || git checkout --orphan gh-pages
# Remove all existing files from the branch
git rm -rf .
# Copy the generated output files into the root directory
cp -r output/* .
# Add and commit the changes
git add .
git commit -m "Deploy generated files to GitHub Pages"
# Push the changes to 'gh-pages' (force to replace old content)
git push --force origin gh-pages