-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (63 loc) · 2.03 KB
/
prompt-deployment.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
59
60
61
62
63
64
65
66
67
68
name: "Prompt Generator"
on:
issues:
types: [labeled]
jobs:
generate-story:
runs-on: ubuntu-latest
if: github.event.label.name == 'story'
outputs:
url: ${{ steps.build.outputs.url }}
title: ${{ steps.build.outputs.title }}
permissions:
contents: write
steps:
- name: Parse Issue Body
id: parse_prompt
uses: peter-murray/issue-forms-body-parser@v4.1.0
with:
issue_id: ${{ github.event.issue.number }}
separator: "###"
label_marker_start: "_"
label_marker_end: "_"
- uses: actions/checkout@v4
- name: Write story data
run: echo ${{ toJson(steps.parse_prompt.outputs.payload) }} > story.json
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm pkg set type="module"
- name: Build file
id: build
run: npm run action
- name: Commit data
run: |
git config --global user.name 'Story Bot'
git config --global user.email 'info@storybot.dev'
TITLE=$(jq -r .title story.json)
git add ./src/blog
git add ./src/img/blog
git commit -m "✍️ $TITLE
Closes #${{ github.event.issue.number }}"
git reset --hard
git pull --rebase
git push --set-upstream origin main
deploy-site:
runs-on: ubuntu-latest
needs: [generate-story]
permissions:
actions: write
issues: write
steps:
- uses: actions/checkout@v4
- name: Deploy workflow
run: gh workflow run deploy-site.yml --field post="$URL" --field title="$TITLE"
env:
GH_TOKEN: ${{ github.token }}
URL: ${{ needs.generate-story.outputs.url }}
TITLE: ${{ needs.generate-story.outputs.title }}
- name: Close Issue
run: gh issue close ${{ github.event.issue.number }} -r completed -c "Post released! Check it out in the [blog](https://storybot.dev/blog)!"
env:
GH_TOKEN: ${{ github.token }}