Skip to content

Update and Deploy #9838

Update and Deploy

Update and Deploy #9838

Workflow file for this run

name: Update and Deploy
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: "*/5 * * * *" # Runs every 5 minutes
# push:
# branches:
# - main
jobs:
update-and-deploy:
runs-on: ubuntu-22.04
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Set up the environment (install necessary tools if needed)
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y curl netcat iputils-ping
# Step 3: Save current index.html to archive
- name: Archive old index
run: |
# Ensure the script is executable
chmod +x archive.sh
./archive.sh
# Step 4: Run the script to update index.html
- name: Run script and update index.html
run: |
# Ensure the script is executable
chmod +x generate-html.sh
# Run the script to generate index.html
./generate-html.sh > index.html
# Step 5: Commit and push changes to the repository
- name: Commit and push updated files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add index.html
git add archive/*
git commit -m "Update index.html and archive with latest script output" || echo "No changes to commit"
git push
# Step 6: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: main # Branch to deploy from (main)
folder: . # Folder to deploy (root directory)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}