-
Notifications
You must be signed in to change notification settings - Fork 8
74 lines (73 loc) · 2.62 KB
/
crosspost.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
name: Cross Poster
on:
push:
branches:
- main
jobs:
crosspost-episode:
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[crosspost]')"
environment:
name: production.crosspost
steps:
- name: Download markdown files that are different from prior commit
run: |
subfolder='content/episode/'
git clone --config lfs.fetchexclude="/podcast_audio" https://github.com/CloudWithChris/cloudwithchris.com.git ./
fileschanged=$(git diff --name-only HEAD^ HEAD -- "$subfolder/*.md")
echo "$fileschanged" > files.txt
cd $subfolder
sed -i -e "s#$subfolder##g" ../../files.txt
for i in *; do
if ! grep -qxFe "$i" ../../files.txt
then
echo "Deleting: $i"
rm "$i"
fi
done
- uses: chrisreddington/hugocrossposter@main
with:
directoryPath: 'content/episode'
recursiveSubdirectories: 'true'
originalPostInformation: 'true'
logPayloadOutput: 'true'
searchPattern: '*.md'
baseUrl: 'www.cloudwithchris.com'
devtoToken: ${{ secrets.DEVTO_INTEGRATION_TOKEN }}
mediumAuthorId: ${{ secrets.MEDIUM_AUTHOR_ID }}
mediumToken: ${{ secrets.MEDIUM_TOKEN }}
protocol: 'https'
crosspost-blog:
if: "contains(github.event.head_commit.message, '[crosspost]')"
runs-on: ubuntu-latest
environment:
name: production.crosspost
steps:
- name: Download markdown files that are different from prior commit
run: |
subfolder='content/blog/'
git clone --config lfs.fetchexclude="/podcast_audio" https://github.com/CloudWithChris/cloudwithchris.com.git ./
fileschanged=$(git diff --name-only HEAD^ HEAD -- "$subfolder/*.md")
echo "$fileschanged" > files.txt
cd $subfolder
escaped_subfolder=$(printf '%s\n' "$subfolder/" | sed 's:[][\\/.^$*]:\\&:g')
sed -i -e "s#$subfolder##g" ../../files.txt
for i in *; do
if ! grep -qxFe "$i" ../../files.txt
then
echo "Deleting: $i"
rm "$i"
fi
done
- uses: chrisreddington/hugocrossposter@main
with:
directoryPath: 'content/blog'
recursiveSubdirectories: 'true'
originalPostInformation: 'true'
logPayloadOutput: 'true'
searchPattern: '*.md'
baseUrl: 'www.cloudwithchris.com'
devtoToken: ${{ secrets.DEVTO_INTEGRATION_TOKEN }}
mediumAuthorId: ${{ secrets.MEDIUM_AUTHOR_ID }}
mediumToken: ${{ secrets.MEDIUM_TOKEN }}
protocol: 'https'