-
Notifications
You must be signed in to change notification settings - Fork 19
169 lines (149 loc) · 5.92 KB
/
screenshots.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
---
name: screenshots
on: # yamllint disable-line rule:truthy
pull_request:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions:
id-token: write
contents: write
pull-requests: write
actions: write
jobs:
screenshots:
if: ${{ ! contains('
release-please--branches
dependabot/
', github.head_ref)
}}
name: screenshots
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- uses: browser-actions/setup-chrome@11cef13cde73820422f9263a707fb8029808e191
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65
# - name: Run test
# uses: tj-actions/puppeteer@a2befb374cdb596ae129a21e0a52494eb028ee82
# id: puppeteer
# with:
# files: |
# puppeteer.js
- name: Install dependencies
run: |
npm i puppeteer
- name: github-profile-screenshot
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3
with:
run: |
node puppeteer.js "https://github.com/${{ github.REPOSITORY_OWNER }}" github-profile.png
- name: github-fork-screenshot
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3
with:
run: |
node puppeteer.js "https://github.com/robinmordasiewicz/devops-toolkit" github-fork.png
- name: github-profile-border
uses: jruipinto/ImageMagick-action@f8361c3ab427051432299cef10d7c76424f7ff6d
with:
command: convert github-profile.png -shave 1x1 -bordercolor black -border 1 github-profile-border.png
- name: github-fork-border
uses: jruipinto/ImageMagick-action@f8361c3ab427051432299cef10d7c76424f7ff6d
with:
command: convert github-fork.png -shave 1x1 -bordercolor black -border 1 github-fork-border.png
- name: create-arrow
run: |
convert -size 486x96 \
xc:transparent \
-stroke red \
-strokewidth 0 \
-fill red \
-draw "ellipse 14,47 11,11 0,360" \
-draw "polygon 482,47 385,4 400,36 10,36 10,58 400,58 385,92" \
arrow.png
- name: rotate-arrows
run: |
convert -rotate 315 -background 'rgba(0,0,0,0)' arrow.png 315-arrow.png
convert -rotate 225 -background 'rgba(0,0,0,0)' arrow.png 225-arrow.png
rm arrow.png
- name: bevel
run: |
width=10
wfact=$((1000*$width))
leveling="-level 0,$wfact"
depth=80
icontr=`convert xc: -format "%[fx:(0.5*$depth-100)]" info:`
ocontr=`convert xc: -format "%[fx:(0.5*$depth-100)]" info:`
ideepening="-brightness-contrast 0,$icontr"
odeepening="-brightness-contrast 0,$ocontr"
for entry in 315-arrow.png 225-arrow.png
do
convert $entry -bordercolor none -border 10x10 -write mpr:img \
-alpha extract -write mpr:alpha \
+level 0,1000 -white-threshold 999 \
-morphology Distance:-1 Euclidean:$width,1000 $leveling \
-shade 120x45 -auto-level $ideepening \
\( +clone -fill "gray(50%)" -colorize 100% \) +swap \( mpr:alpha -threshold 0 \) \
-compose over -composite \
\( mpr:img -alpha off \) +swap -compose hardlight -composite \
mpr:alpha -alpha off -compose copy_opacity -composite \
-shave 10x10 \
arrow-bevel.png
mv arrow-bevel.png $entry
done
- name: create-border-shadow
run: |
for entry in 315-arrow.png 225-arrow.png
do
convert $entry \
-bordercolor none -border 20 \
\( -clone 0 -fill white -colorize 100 \) \
\( -clone 0 -alpha extract -write mpr:alpha -morphology edgeout disk:2 \) \
-alpha off -compose over -composite \
\( mpr:alpha -morphology dilate disk:2 \) \
-alpha off -compose copy_opacity -composite \
output.png
convert output.png \
-bordercolor none -border 20 \
\( -clone 0 -fill black -colorize 100 \) \
\( -clone 0 -alpha extract -write mpr:alpha -morphology edgeout disk:1 \) \
-alpha off -compose over -composite \
\( mpr:alpha -morphology dilate disk:1 \) \
-alpha off -compose copy_opacity -composite \
$entry
convert $entry \
\( +clone -background black -shadow 50x10+10+10 \) \
+swap \
-background none \
-layers merge \
+repage \
output.png
mv output.png $entry
done
- name: overlay-arrow
run: |
composite -geometry +915+140 315-arrow.png github-fork-border.png github-fork-arrow.png
mv github-fork-arrow.png github-fork.png
composite -geometry +525+160 225-arrow.png github-profile.png github-profile-arrow.png
mv github-profile-arrow.png github-profile.png
- name: make-drop-shadow
run: |
for entry in github-profile.png github-fork.png
do
convert $entry \( +clone -background black -shadow 100x40+0+16 \) \
+swap -background none -layers merge +repage output.png
convert output.png -bordercolor none -border 32 docs/img/$entry
rm $entry output.png
done
- name: cleanup
run: |
rm output.png 315-arrow.png 225-arrow.png arrow.png
- name: Push changes
run: |
git config user.name "$(git log -n 1 --pretty=format:%an)"
git config user.email "$(git log -n 1 --pretty=format:%ae)"
git add .
git commit -m "docs: updating screenshots"
git push