Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CircleCI x HatenaBlog

C582b722e015633f7900083f8ea75732?s=47 hatappi
June 10, 2016

CircleCI x HatenaBlog

C582b722e015633f7900083f8ea75732?s=128

hatappi

June 10, 2016
Tweet

Transcript

  1. CircleCI x HatenaBlog CircleCI Meetup 2016-06-10

  2. ࣗݾ঺հ » ാத༔࡞ » גࣜձࣾSpeee » ओʹRails͔͍ͨΓAWS࢖ͬͨΓ » ͜Ε͔Β͸AngularJS2ͳͲ΋ »

    Twitter: @hatappi » Github: hatappi
  3. Έͳ͞Μϒϩά͔͍ͯ·͔͢ʁ

  4. http://technica-blog.jp/

  5. ੈͷதʹ͸༷ʑͳπʔϧͰϒϩά͕͔͚Δ » WordPress » ͸ͯͳϒϩά » etc...

  6. ͸ͯͳϒϩά͸هࣄ͕ॻ͖΍͍͢ʂ » Ξοϓσʔτͨ͠Β͍Ε͍ͯͨϓϥάΠϯ͕ಈ͔ͳ͍ɻͰ΋Ξοϓσ ʔτ͍ͨ͠ʂͱ͔͕ͳ͍ » ฐࣾ΋࠷ॳ͸AWSʹword̋ressΛ৐ͤͯͨͷͰɺαʔόʔ΋ϝϯς ͠ͳ͍ͱ͍͚ͳ͍͠ӡ༻ͷίετେ!

  7. ͨͩ͠

  8. ϨϏϡʔ͕ͳ͍

  9. ͔ΘΓʹ » ࠷ॳ͸Qiita::Teamͱ͔ʹυϥϑτΛ͋͛ͯɺҾ༻ͱ͔ͯ͠ϨϏϡʔ ͯͨ͠ » ͨͩෳ਺ਓͰϨϏϡʔ͍ͯ͠ΔͷͰٞ࿦͕ೖΓཚΕͯͣ͠Β͍

  10. !

  11. ๻Βʹ͸GitHub͕͋Δ

  12. هࣄެ։·ͰͷྲྀΕ 1. master͔Βϒϥϯν͖ͬͯهࣄΛ͔͖ 2. Լه͓ΘͬͨΒPRग़ͯ͠ϨϏϡʔͯ͠΋Β͏ 3. :LGTM:͕ू·ͬͨΒϚʔδͯ͠खಈͰ͸ͯͳϒϩά΁౤ߘ 4. ݟͨ໨ͱ͔Λ֬ೝͯ͠ެ։ʂ

  13. GitHubͰهࣄΛॻ͘ͱ Կ͕͏·͍ͷ͔!

  14. GitHubͰهࣄΛॻ͘ͱԿ͕͏·͍ͷ͔! 1. ΤϯδχΞ͕ۀ຿Ͱ࢖༻͍ͯ͠ΔαʔϏεΛར༻ͯ͠ӡ༻Ͱ͖Δ 2. ϨϏϡʔ͕Օ৚ॻ͖Ͱͳ͘ ಛఆͷߦʹରͯ͠ॻ͚Δɻ ͞ΒʹͦΕʹରͯ͠ίϝϯτΛ࿈ͶΔ͜ͱ͕Ͱ͖ͯٞ࿦͕͠΍͍͢

  15. Githubӡ༻࠷ߴ!

  16. Ϛʔδޙͷهࣄ͸ը૾΋ؚΊͯ खಈͰ͸ͯͳϒϩά΁!

  17. ࣗಈԽ͍ͨ͠!

  18. None
  19. CircleCIͷ؀ڥ » ༷ʑͳ؀ڥ͕༻ҙ͞Ε͓ͯΓɺruby΋࠷৽൛ͷ2.3.1͕࢖͑Δ » ଍Γͳ͍΋ͷ͕͋Ε͹sudo apt-get install ؤுΕ͹ͳΜͱ͔ͳΓͦ͏ʂʂ

  20. هࣄެ։·ͰͷྲྀΕ 1. master͔Βϒϥϯν͖ͬͯهࣄΛ͔͖ 2. Լه͓ΘͬͨΒPRग़ͯ͠ϨϏϡʔ 3. :LGTM:͕ू·ͬͨΒϚʔδͯ͠खಈͰ౤ߘ :LGTM:͕ू·ͬͨΒϚʔδ͢ΔͱCircleCIͰࣗಈ౤ߘ 4. ݟͨ໨ͱ͔Λ֬ೝͯ͠ެ։ʂ

  21. σΟϨΫτϦߏ੒ root_dir ᵓ circle.yml ᵓ script ᴹ ᵋ deploy.sh ᵋ

    articles ɹɹᵓ هࣄ1 ɹɹɹɹᵓ هࣄ1.md ɹɹᵓ هࣄ2 ɹɹɹɹᵋ هࣄ2.md
  22. circle.yml deployment: production: branch: master commands: # masterͷͱ͖͚ͩεΫϦϓτΛ࣮ߦ - sh

    -e ./script/deploy.sh
  23. هࣄΞοϓϩʔυͷϙΠϯτ͸̎ͭ » ର৅هࣄͷಛఆ » ը૾ͷΞοϓϩʔυ

  24. ର৅هࣄΛऔΓग़͢ํ๏

  25. ର৅هࣄΛऔΓग़͢ํ๏ git log͔ΒؤுͬͯऔΓग़͠·͢

  26. ର৅هࣄΛऔΓग़͢ํ๏ git log͔ΒؤுͬͯऔΓग़͠·͢ printf "$(git log --name-status -p -1)" |

    egrep "^[AM]\s+\"?articles\/.*\.md" | awk '{print $2}' | head -1 | sed -e 's/^\"//g' | sed -e 's/\"$//g'
  27. !

  28. ը૾͸͸ͯͳϑΥτϥΠϑͷAPIΛ࢖༻ ## ͜͏ͳ͍ͬͯΔͷΛ ![ςετ](./images/test.png) ↓ ## ͸ͯͳϑΥτϥΠϑͷAPIͰ͔͖͑ͬͯͨURLͰஔ׵ ![ςετ](http://cdn-ak.f.st-hatena.com/images/fotolife/k/xxxx/yyyy/zzzzz.jpg)

  29. ͸ͯͳϒϩά͸MarkdownʹରԠͯ͠ ͍ΔͷͰɺޙ͸ͦͷ··͸ͯͳϒϩά APIͰΞοϓϩʔυ͢Δ͚ͩ

  30. ࣮ࡍͷίʔυͳͲʹ͍ͭͯ͸Լهʹ͋Γ·͢ https://github.com/hatappi/circlecitohatenablog

  31. None
  32. ྑ͔ͬͨΒ༡ͼʹ͖͍ͯͩ͘͞