Skip to content

Commit 78e0819

Browse files
committedJul 17, 2022
feat: update deploy.yml
1 parent 357067a commit 78e0819

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed
 

‎.github/workflows/deploy.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,5 @@ jobs:
4747

4848
# Runs a single command using the runners shell
4949
- name: Run a one-line script
50-
run: ./Script/ci_run.sh
51-
shell: bash
52-
53-
# - name: Push Repo
54-
# uses: actions-js/push@master
55-
# with:
56-
# github_token: ${{ secrets.ACCESS_TOKEN }}
57-
50+
run: ./Script/ci_run.sh ${{ github.event.inputs.weekly_index }}
51+
shell: bash

‎Script/ci_run.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/bash
22

3-
path=$(cd $(dirname $0); pwd)
3+
path=$(cd $(dirname "$0"); pwd)
44
deploy="${path}/deploy.py"
5-
python3 ${deploy}
5+
6+
if [ -n "$1" ]; then
7+
python3 "${deploy}" --index "$1"
8+
else
9+
python3 "${deploy}"
10+
fi

‎Script/deploy.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ def get_blog_head_contents(self, title):
3434
date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
3535
today = f"date: {date}"
3636

37+
date_path_format = time.strftime("%Y/%m/%d", time.localtime())
38+
file_name_format = os.path.splitext(self.file_name)[0]
39+
# for real address
40+
blog_url = f"https://zhangferry.com/{date_path_format}/{file_name_format}"
41+
print(f"Blog url: {blog_url}")
42+
3743
cover = "cover: https://cdn.zhangferry.com/Images/moyu_weekly_cover.jpeg"
3844
tags = "tags:\n\t- iOS摸鱼周报"
3945
comments = "comments: true"
@@ -145,4 +151,4 @@ def run_with(self, blog_repo):
145151
blog_repo = BlogRepo(token=blog_token, git_url=blog_git_url, branch=blog_branch)
146152
builder.run_with(blog_repo=blog_repo)
147153

148-
print("push weekly article success! 🚀")
154+
print("Deploy weekly article success! It will take effect in about 10 minutes 🚀")

0 commit comments

Comments
 (0)