From bfc5959438c29612b00952fcc107f2b75795d120 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 21:20:28 +0900 Subject: [PATCH 01/12] Test the CI to generate OGP. --- .drone.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.drone.yml b/.drone.yml index c129685..7db99cd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,17 +9,6 @@ steps: - grep -l -r ecx.images-amazon.com content/ | sort | uniq | xargs -t --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g" - grep -l -r "http://www.amazon.co.jp/exec" content/ | sort | uniq | xargs -t --no-run-if-empty sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g" - - name: generate-ogp-images - image: reg.kazu634.com/kazu634/tcardgen:v0.3 - commands: - - mkdir -p static/ogp/ - - wget 'https://github.com/yuru7/HackGen/releases/download/v2.3.0/HackGenNerd_v2.3.0.zip' -O /tmp/font.zip - - unzip /tmp/font.zip -d /tmp/font - - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ - - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null 2>&1 - - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o `echo % | sed -e 's/png/webp/g'` > /dev/null 2>&1 - - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm - - name: hugo image: cibuilds/hugo:0.83.0 commands: @@ -73,6 +62,17 @@ steps: - grep -l -r ecx.images-amazon.com content/ | sort | uniq | xargs -t --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g" - grep -l -r "http://www.amazon.co.jp/exec" content/ | sort | uniq | xargs -t --no-run-if-empty sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g" + - name: generate-ogp-images + image: reg.kazu634.com/kazu634/tcardgen:v0.3 + commands: + - mkdir -p static/ogp/ + - wget 'https://github.com/yuru7/HackGen/releases/download/v2.3.0/HackGenNerd_v2.3.0.zip' -O /tmp/font.zip + - unzip /tmp/font.zip -d /tmp/font + - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ + - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null 2>&1 + - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o `echo % | sed -e 's/png/webp/g'` > /dev/null 2>&1 + - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm + - name: hugo image: cibuilds/hugo:0.83.0 commands: From cfe3b63a618acf09fc27c8eab1707f3f7df355ea Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 21:30:32 +0900 Subject: [PATCH 02/12] Modify the logic to rename. --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 7db99cd..c500290 100644 --- a/.drone.yml +++ b/.drone.yml @@ -70,7 +70,8 @@ steps: - unzip /tmp/font.zip -d /tmp/font - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null 2>&1 - - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o `echo % | sed -e 's/png/webp/g'` > /dev/null 2>&1 + - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o %.webp > /dev/null 2>&1 + - find static/ogp/ -type f -name '*.png.webp' | xargs -I% -n 1 -t mv % static/ogp/`basename % .png.webp`.webp - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm - name: hugo From c650de9149dee85b1cad6f11da56fe16a998d0c9 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 21:42:05 +0900 Subject: [PATCH 03/12] Add `.gitkeep`. --- static/ogp/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 static/ogp/.gitkeep diff --git a/static/ogp/.gitkeep b/static/ogp/.gitkeep new file mode 100644 index 0000000..e69de29 From af8d0be7bb88855eae4f2bc95c91baa829a7b32d Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 21:43:23 +0900 Subject: [PATCH 04/12] Show the standard errors. --- .drone.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index c500290..fa2c6f2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -65,12 +65,12 @@ steps: - name: generate-ogp-images image: reg.kazu634.com/kazu634/tcardgen:v0.3 commands: - - mkdir -p static/ogp/ + - mkdir -p static/ogp/ && rm static/ogp/* - wget 'https://github.com/yuru7/HackGen/releases/download/v2.3.0/HackGenNerd_v2.3.0.zip' -O /tmp/font.zip - unzip /tmp/font.zip -d /tmp/font - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ - - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null 2>&1 - - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o %.webp > /dev/null 2>&1 + - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null + - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o %.webp > /dev/null - find static/ogp/ -type f -name '*.png.webp' | xargs -I% -n 1 -t mv % static/ogp/`basename % .png.webp`.webp - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm From 536d9d85a655a14e2e7513f0c3607be6cbb70b5f Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 21:45:10 +0900 Subject: [PATCH 05/12] Do not housekeep, because no need to housekeep. --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index fa2c6f2..fff4c5e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -65,7 +65,6 @@ steps: - name: generate-ogp-images image: reg.kazu634.com/kazu634/tcardgen:v0.3 commands: - - mkdir -p static/ogp/ && rm static/ogp/* - wget 'https://github.com/yuru7/HackGen/releases/download/v2.3.0/HackGenNerd_v2.3.0.zip' -O /tmp/font.zip - unzip /tmp/font.zip -d /tmp/font - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ From f0c398341bbe685ef29de2dbf5ca602100a34abd Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 21:51:12 +0900 Subject: [PATCH 06/12] Try and error. --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index fff4c5e..163ed80 100644 --- a/.drone.yml +++ b/.drone.yml @@ -70,7 +70,6 @@ steps: - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o %.webp > /dev/null - - find static/ogp/ -type f -name '*.png.webp' | xargs -I% -n 1 -t mv % static/ogp/`basename % .png.webp`.webp - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm - name: hugo From 3ae92074b33bb8738ad25876b2b70e6261705784 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 22:14:42 +0900 Subject: [PATCH 07/12] Modify the logic to rename. --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index 163ed80..e9768e9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -71,6 +71,7 @@ steps: - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o %.webp > /dev/null - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm + - for webp in $(find static/ogp/ -type f -name *.webp); do mv ${webp} ${webp//.png./.}; done - name: hugo image: cibuilds/hugo:0.83.0 From 968286ea07ae5bf55035d393eb09a30338f8ac90 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 22:21:30 +0900 Subject: [PATCH 08/12] Modify the logic to rename. --- .drone.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index e9768e9..e1441f5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -69,9 +69,8 @@ steps: - unzip /tmp/font.zip -d /tmp/font - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null - - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o %.webp > /dev/null + - find static/ogp/ -type f -name '*.png' | xargs -I% -t -n 1 img2webp -lossy -q 50 % -o $(basename % .png).webp > /dev/null - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm - - for webp in $(find static/ogp/ -type f -name *.webp); do mv ${webp} ${webp//.png./.}; done - name: hugo image: cibuilds/hugo:0.83.0 From 13021021891f2b27e68e73a2979cd358940cf913 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 22:31:08 +0900 Subject: [PATCH 09/12] Modify the logic to rename. --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index e1441f5..b0ae1fd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -69,8 +69,9 @@ steps: - unzip /tmp/font.zip -d /tmp/font - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null - - find static/ogp/ -type f -name '*.png' | xargs -I% -t -n 1 img2webp -lossy -q 50 % -o $(basename % .png).webp > /dev/null + - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o %.webp > /dev/null - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm + - find static/ogp/ -type f -name '*.png.webp' | xargs -n 1 -I% basename % .png.webp | xargs -t -n 1 -I% mv %.png.webp %.png - name: hugo image: cibuilds/hugo:0.83.0 From 73d6002589c88bcb0e5f48a31a717fea56acdae7 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 22:38:11 +0900 Subject: [PATCH 10/12] Modify the logic to rename. --- .drone.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index b0ae1fd..fa5a3d4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -69,9 +69,8 @@ steps: - unzip /tmp/font.zip -d /tmp/font - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null - - find static/ogp/ -type f -name '*.png' | xargs -I% -n 1 img2webp -lossy -q 50 % -o %.webp > /dev/null + - find static/ogp/ -type f -name '*.png' | xargs -n 1 -I% basename % .png | xargs -I% -n 1 -t img2webp -lossy -q 50 static/ogp/% -o static/ogp/%.webp > /dev/null - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm - - find static/ogp/ -type f -name '*.png.webp' | xargs -n 1 -I% basename % .png.webp | xargs -t -n 1 -I% mv %.png.webp %.png - name: hugo image: cibuilds/hugo:0.83.0 From 5b6c282a77fa0e7ce8f3acb0a3354afc711fa8c3 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 22:41:56 +0900 Subject: [PATCH 11/12] Add .png extention. --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index fa5a3d4..2c9de8c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -69,7 +69,7 @@ steps: - unzip /tmp/font.zip -d /tmp/font - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null - - find static/ogp/ -type f -name '*.png' | xargs -n 1 -I% basename % .png | xargs -I% -n 1 -t img2webp -lossy -q 50 static/ogp/% -o static/ogp/%.webp > /dev/null + - find static/ogp/ -type f -name '*.png' | xargs -n 1 -I% basename % .png | xargs -I% -n 1 -t img2webp -lossy -q 50 static/ogp/%.png -o static/ogp/%.webp > /dev/null - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm - name: hugo From 0c702aa60b3578613a3b15da184aead8bb988d62 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Thu, 6 May 2021 22:48:30 +0900 Subject: [PATCH 12/12] Move to production. --- .drone.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2c9de8c..5b1871e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,6 +9,16 @@ steps: - grep -l -r ecx.images-amazon.com content/ | sort | uniq | xargs -t --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g" - grep -l -r "http://www.amazon.co.jp/exec" content/ | sort | uniq | xargs -t --no-run-if-empty sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g" + - name: generate-ogp-images + image: reg.kazu634.com/kazu634/tcardgen:v0.3 + commands: + - wget 'https://github.com/yuru7/HackGen/releases/download/v2.3.0/HackGenNerd_v2.3.0.zip' -O /tmp/font.zip + - unzip /tmp/font.zip -d /tmp/font + - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ + - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null + - find static/ogp/ -type f -name '*.png' | xargs -n 1 -I% basename % .png | xargs -I% -n 1 img2webp -lossy -q 50 static/ogp/%.png -o static/ogp/%.webp > /dev/null + - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm + - name: hugo image: cibuilds/hugo:0.83.0 commands: @@ -62,16 +72,6 @@ steps: - grep -l -r ecx.images-amazon.com content/ | sort | uniq | xargs -t --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g" - grep -l -r "http://www.amazon.co.jp/exec" content/ | sort | uniq | xargs -t --no-run-if-empty sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g" - - name: generate-ogp-images - image: reg.kazu634.com/kazu634/tcardgen:v0.3 - commands: - - wget 'https://github.com/yuru7/HackGen/releases/download/v2.3.0/HackGenNerd_v2.3.0.zip' -O /tmp/font.zip - - unzip /tmp/font.zip -d /tmp/font - - find /tmp/font -type f -name *.ttf | xargs -I% -n 1 cp -p % assets/font/ - - find content/ -type f -name '*.md' | grep -v '_index' | xargs -n 1 /usr/local/bin/tcardgen -f assets/font/ -o static/ogp/ -c assets/tcardgen.yaml > /dev/null - - find static/ogp/ -type f -name '*.png' | xargs -n 1 -I% basename % .png | xargs -I% -n 1 -t img2webp -lossy -q 50 static/ogp/%.png -o static/ogp/%.webp > /dev/null - - find static/ogp/ -type f -name '*.png' | xargs --no-run-if-empty rm - - name: hugo image: cibuilds/hugo:0.83.0 commands: