-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (49 loc) · 1.82 KB
/
create-issue-posts.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
name: create-issue-posts 🚀
on:
issues:
types: [opened, edited, reopened]
jobs:
create-post:
runs-on: ubuntu-latest
steps:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.85.0'
- uses: actions/[email protected]
- name: Create content 👨💻
run : |
mkdir -p content/post
git clone https://github.com/MeiK2333/github-style.git themes/github-style
file="content/post/${{ github.event.issue.number }}-${{ github.event.issue.title }}.md"
echo "Deleting existing post with name issue number"
delfile="${{github.event.issue.number}}-"
rm -rf $(find . | grep $delfile)
file=$(echo $file | tr -d ' ')
echo "Post Name : $file"
touch $file
echo "---" >> $file
echo "title: \"${{ github.event.issue.title }}\"" >> $file
echo "date: \"${{ github.event.issue.created_at }}\"" >> $file
echo "draft: false" >> $file
echo "${{ github.event.issue.body }}" >> $file
hugo -D -b https://aryamanz29.github.io/posts/ -t github-style
- name: Publish content 🚀
uses: stefanzweifel/git-auto-commit-action@v4
id: auto-commit-action
with:
commit_message: 'New Post: ${{ github.event.issue.title }}'
commit_options: '--allow-empty'
repository: .
status_options: '--untracked-files=no'
file_pattern: 'content/**/*'
push_options: '--force'
skip_dirty_check: true
skip_fetch: true
disable_globbing: true
- name: Update Gh-pages ✅
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./public