Skip to content

Deploy MimFlix Project #9

Deploy MimFlix Project

Deploy MimFlix Project #9

Workflow file for this run

name: Deploy MimFlix Project
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the Repository
- name: Checkout Repository
uses: actions/checkout@v3
# Step 2: Set up GitHub Actions Bot for Git Operations
- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Step 3: Run the Startup Script
- name: Run Startup Script
run: |
chmod +x ./startup.sh
./startup.sh
# Step 4: Force Create Changes if Necessary
- name: Force Create Changes if Necessary
run: |
if git status --porcelain | grep -q '^ M'; then
echo "Changes detected, preparing to commit."
else
echo "No changes detected. Creating dummy change for testing."
echo "# Dummy File for Forcing Commit" >> dummy.txt
git add dummy.txt
fi
# Step 5: Commit and Push Generated Files
- name: Commit and Push Generated Files
run: |
git add .
git commit -m "Automated: Project files created or updated by startup.sh" || echo "Nothing to commit"
git push origin main
# Step 6: Notify via Email
- name: Send Email Notification
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: "MimFlix Deployment Notification"
body: |
The MimFlix deployment workflow has been successfully executed.
Branch: main
Commit Message: Automated: Project files created or updated by startup.sh
to: ${{ secrets.RECIPIENT_EMAIL }}
from: MimFlix Bot <${{ secrets.EMAIL_USERNAME }}>