Skip to content

Commit

Permalink
Add GitHub actions (#60)
Browse files Browse the repository at this point in the history
* Send email with just one click (easy as pie!)
  • Loading branch information
Amir Hossein Baghaie authored Jan 11, 2021
1 parent 17f642d commit 64b4b15
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "♨️ Send email for all users"

on:
workflow_dispatch:

jobs:
send-email-for-all-users:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2

- name: Install Composer dependencies
run: composer install --no-progress --optimize-autoloader --quiet

- name: Import BOTTOM_CONTENT_HTML and TOP_CONTENT_HTML into env
shell: bash
run: |
echo "BOTTOM_CONTENT_HTML=$(cat BOTTOM_CONTENT_HTML.txt)" >> $GITHUB_ENV
echo "TOP_CONTENT_HTML=$(cat TOP_CONTENT_HTML.txt)" >> $GITHUB_ENV
- name: Run script
run: php main.php
env:
PAKAT_SMTP_USERNAME: ${{ secrets.PAKAT_SMTP_USERNAME }}
PAKAT_SMTP_PASSWORD: ${{ secrets.PAKAT_SMTP_PASSWORD }}
PAKAT_API_KEY: ${{ secrets.PAKAT_API_KEY }}
BOTTOM_CONTENT_HTML: ${{ env.BOTTOM_CONTENT_HTML }}
TOP_CONTENT_HTML: ${{ env.TOP_CONTENT_HTML }}
SEND_ENV: "production"
36 changes: 36 additions & 0 deletions .github/workflows/staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "🍊 Send email for test users"

on:
workflow_dispatch:

jobs:
send-email-for-test-users:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2

- name: Install Composer dependencies
run: composer install --no-progress --optimize-autoloader --quiet

- name: Import BOTTOM_CONTENT_HTML and TOP_CONTENT_HTML into env
shell: bash
run: |
echo "BOTTOM_CONTENT_HTML=$(cat BOTTOM_CONTENT_HTML.txt)" >> $GITHUB_ENV
echo "TOP_CONTENT_HTML=$(cat TOP_CONTENT_HTML.txt)" >> $GITHUB_ENV
- name: Run script
run: php main.php
env:
PAKAT_SMTP_USERNAME: ${{ secrets.PAKAT_SMTP_USERNAME }}
PAKAT_SMTP_PASSWORD: ${{ secrets.PAKAT_SMTP_PASSWORD }}
PAKAT_API_KEY: ${{ secrets.PAKAT_API_KEY }}
BOTTOM_CONTENT_HTML: ${{ env.BOTTOM_CONTENT_HTML }}
TOP_CONTENT_HTML: ${{ env.TOP_CONTENT_HTML }}
SEND_ENV: "test"
1 change: 1 addition & 0 deletions BOTTOM_CONTENT_HTML.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'<p style="font-size: 16px; text-align: center; font-family: 'Samim'; direction: rtl; color: #263238; "><img src='https://pakat.net/wp-content/uploads/2020/02/pakat-new-logo-white_00ea005b1_2512.png'><br> ارسال شده توسط <a href="https://pakat.net/">پاکت</a></p><p style=" font-size: 14px; text-align: center; font-family: 'Samim'; direction: rtl; color: #263238; "> <a href="https://pakat.net/">سرویس پاکت</a> اسپانسر ارسال ایمیل<200c>های این خبرنامه است. با کد تخفیف sota10 می<200c>توانید از ۱۰ درصد تخفیف در خرید پلن<200c>های پاکت بهره<200c>مند شوید</p>'
1 change: 1 addition & 0 deletions TOP_CONTENT_HTML.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
''

0 comments on commit 64b4b15

Please sign in to comment.