Image Bot #706
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
name: 'Image Bot' | |
on: | |
workflow_dispatch: | |
push: | |
schedule: | |
- cron: '0 4 * * *' | |
jobs: | |
bot: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v3 | |
- name: 'GET Images' | |
run: | | |
mkdir img | |
npm install | |
node ./index.js | |
- name: 'Get Date' | |
run: | | |
echo "REPORT_DATE=$(TZ='Asia/Shanghai' date '+%Y-%m-%d %T')" >> $GITHUB_ENV | |
- name: 'Send mail' | |
uses: dawidd6/action-send-mail@master | |
with: | |
server_address: smtp.gmail.com | |
server_port: 465 | |
secure: true | |
username: ${{secrets.MAIL_USERNAME}} | |
password: ${{secrets.MAIL_PASSWORD}} | |
subject: 每日图片(${{env.REPORT_DATE}}) | |
to: ${{secrets.MAIL_RECEIVER}} | |
from: CLZ | |
html_body: file://result.html | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: build # 部署后提交到那个分支 | |
folder: img |