-
Notifications
You must be signed in to change notification settings - Fork 70
95 lines (81 loc) · 3.26 KB
/
create-content-file.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Create content file
on:
schedule:
- cron: '20 14 * * 1-5'
workflow_dispatch:
env:
DEBUG: 1
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
GOOGLE_REFRESH_TOKEN: ${{ secrets.GOOGLE_REFRESH_TOKEN }}
# ACTIONS_RUNNER_DEBUG: true
# ACTIONS_STEP_DEBUG: true
jobs:
CreateContentFile:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.JS environment
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
- name: Global output
id: global
run: |
echo "formattedDate=$(date +%d/%m/%Y)"
echo "bashDate=$(date +%d-%m-%Y)"
- name: podcast-maker CLI cache
uses: actions/cache@v3
id: podcast-maker-cache
with:
path: |
**/node_modules
dist
bin
key: cli-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/pnpm.lock') }}
- name: Build
if: steps.podcast-maker-cache.outputs.cache-hit != 'true'
run: |
pnpm i
pnpm build
- name: Create SymLink from content directory (on code) to content directory (created by podcast-maker CLI)
run: |
ContentPath=$(./bin/run info content --dir)
if [ -d "$ContentPath" ]; then
ls $ContentPath;
echo "ContentPath exists, deleting it";
rm -rf $ContentPath;
fi;
echo "Creating SymLink from $(pwd)/content to $ContentPath";
ln -s $(pwd)/content $ContentPath
- name: Get current date
id: date
run: |
echo "formattedDate=$(date +%d/%m/%Y)" >> $GITHUB_OUTPUT
echo "bashDate=$(date +%d-%m-%Y)" >> $GITHUB_OUTPUT
- name: Create Content File
run: ./bin/run content mail
- name: Generate GitHub Token
uses: tibdex/[email protected]
id: generate-token
with:
app_id: ${{ secrets.ID_GITHUB_APP }}
private_key: ${{ secrets.PRIVATE_KEY_GITHUB_APP }}
- name: Create PR to master with Content File
uses: peter-evans/create-pull-request@v4
with:
title: Conteúdo ${{ steps.date.outputs.formattedDate }}
body: Automação - Conteúdo ${{ steps.date.outputs.formattedDate }}
branch: ${{ steps.date.outputs.formattedDate }}
commit-message: Conteúdo ${{ steps.date.outputs.formattedDate }}
token: ${{ steps.generate-token.outputs.token }}
# - name: SSH debug
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true