forked from MimFlix/MimFlix
-
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
bd1928b
commit 70f8b5d
Showing
1 changed file
with
48 additions
and
8 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 |
---|---|---|
@@ -1,32 +1,72 @@ | ||
name: Deploy MimFlix | ||
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@v2 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Shell Environment | ||
# Step 2: Set up GitHub Actions Bot for Git Operations | ||
- name: Configure Git | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y bash | ||
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 Dummy Changes if None Exist | ||
- 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 config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git add . | ||
git commit -m "Automated: Project files created by startup.sh" | ||
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: Notify via GitHub Actions Mail Bot | ||
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 Workflow Notification" | ||
body: | | ||
The deployment workflow has been successfully executed. | ||
Branch: main | ||
Commit Message: Automated: Project files created or updated by startup.sh | ||
to: "[email protected]" | ||
from: "MimFlix Bot <[email protected]>" | ||
|
||
# Optional Step: Slack Notification (If Slack Integration Required) | ||
- name: Notify via Slack (Optional) | ||
if: always() | ||
uses: rtCamp/action-slack-notify@v2 | ||
with: | ||
status: ${{ job.status }} | ||
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
message: "MimFlix Workflow Completed with Status: ${{ job.status }}." |