-
Notifications
You must be signed in to change notification settings - Fork 12
58 lines (46 loc) · 1.72 KB
/
weekly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: newsletter_every_fri
on:
schedule:
# every 3am(UTC) which is 12pm in Korea on Friday
- cron: "0 3 * * FRI"
workflow_dispatch:
jobs:
newsletter:
name: newsletter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8.3
uses: actions/setup-python@v2
with:
python-version: 3.8.3
- name: Install pipenv
run: pip install pipenv
- name: Install dependencies via pipenv
run: pipenv install
- name: Decrypt .env.gpg => .env
env:
SYMMETRIC_KEY: ${{ secrets.GPG_KEY }}
run: gpg --quiet --batch --yes --decrypt --passphrase="$SYMMETRIC_KEY" --output=.env .env.gpg
- name: Set Variables
id: var
run: |
echo "::set-output name=SINCE::$(date --date='7 days ago' +%Y-%m-%d)"
echo "::set-output name=UNTIL::$(date +'%Y-%m-%d')"
echo "::set-output name=TITLE::TF-KR 주간 뉴스레터"
- name: Sending out Email
run:
export $(cat .env | xargs) && pipenv run python main.py --since ${{ steps.var.outputs.SINCE }} --until ${{ steps.var.outputs.UNTIL }} --email-title '${{ steps.var.outputs.TITLE }}'
- name: Remove .env.gpg
run: rm .env.gpg
- name: Encrypt .env => .env.gpg
env:
SYMMETRIC_KEY: ${{ secrets.GPG_KEY }}
run: echo "$SYMMETRIC_KEY" | gpg --symmetric --batch --passphrase-fd 0 .env
- name: Push .env.gpg
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git pull
git commit -am 'Updating .env.gpg'
git push