Created
July 15, 2023 05:52
-
-
Save PttCodingMan/e303178da7886baa6f2e08f2ae979658 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: deploy-blog | |
on: | |
schedule: | |
- cron: '22 22 * * *' | |
push: | |
branches: | |
- publish | |
paths: | |
- 'source/**/*.md' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Deploy blog. | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true # Checkout private submodules(themes or something else). | |
- name: Set timezone | |
uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Asia/Taipei" | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Update rating | |
id: update_rating | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Output api.json | |
run: | | |
echo "${{ secrets.G_API }}" > .scripts/api.json | |
- name: Update rating | |
env: | |
VIEW_ID: ${{ secrets.G_VIEW_ID }} | |
GOOGLE_APPLICATION_CREDENTIALS: './.scripts/api.json' | |
run: | | |
python .scripts/update_rating.py | |
- name: Update related posts | |
run: | | |
cd .scripts | |
python related_post.py | |
- name: Deploy | |
id: deploy | |
uses: sma11black/[email protected] | |
with: | |
deploy_key: ${{ secrets.DEPLOY_KEY }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment