Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
はてなブログ作成から投稿までをGitHub Actionsで自動化する
Search
M-Yamashita
November 02, 2022
Programming
3
1.1k
はてなブログ作成から投稿までをGitHub Actionsで自動化する
【LT満員御礼!】自動化大好きエンジニアLT会 - vol.9の登壇資料です。
https://rakus.connpass.com/event/259685/
M-Yamashita
November 02, 2022
Tweet
Share
More Decks by M-Yamashita
See All by M-Yamashita
継続的な活動で築く地方エンジニアの道
myamashii
2
600
テストの高速化と品質保証の第一歩 GitHub ActionsとRSpecの基本入門
myamashii
1
550
Contributionとカンファレンス登壇への 背中を押して頂いた方々へ
myamashii
1
1.5k
GitHub ActionsでZennの記事を限定公開する
myamashii
3
840
Webサービス開発者としてスタートしてからOSS Contributionまでの道のり
myamashii
0
710
Fukuoka.rb 2020年度活動報告
myamashii
0
750
OSS Contributionから感じたこと
myamashii
0
340
手動テストやインフラ構築は自動化しよう
myamashii
0
17k
試行錯誤の勉強法
myamashii
1
4.7k
Other Decks in Programming
See All in Programming
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
180
CSC305 Lecture 26
javiergs
PRO
0
140
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
Beyond ORM
77web
5
520
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
Symfony Mapper Component
soyuka
2
730
useSyncExternalStoreを使いまくる
ssssota
6
1k
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
120
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
Zoneless Testing
rainerhahnekamp
0
120
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Producing Creativity
orderedlist
PRO
341
39k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Building Applications with DynamoDB
mza
91
6.1k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Transcript
2022-11-02 ࣗಈԽେ͖ΤϯδχΞLTձ - vol.9 ͯͳϒϩά࡞͔Βߘ·ͰΛ GitHub ActionsͰࣗಈԽ͢Δ M-Yamashita
• ࢁԼ խਓ • όοΫΤϯυΤϯδχΞ • ॴଐ: גࣜձࣾΞΠΩϡʔϒυγεςϜζ • GitHub
Actions ͕͖ • GitHub: @M-Yamashita01 • Twitter: @M_Yamashii ࣗݾհ
• ຖ݄ͷৼΓฦΓΛͯͳϒϩάʹࣥචத എܠ
ϒϩά࡞ͷաఔͰຖճൃੜ͢Δ୯७࡞ۀ
ੵΔετϨε
• ৽نߘ࣌ɺաڈͷϒϩάͷ߲Λίϐϖͯ͠৽͘͠จষΛهࡌ • VSCode্ͰจষΛtextlintͰνΣοΫ͠ɺͯͳϒϩάʹసه • VSCodeͱͯͳϒϩάͷߦ͖དྷ͕ਏ͍ ࠔͬͨ͜ͱ
Ͳ͏ͳͬͨΒخ͍͠ʁ
Ͳ͏ͳͬͨΒخ͍͠ʁ • จষΛॻ͘πʔϧVSCode͚ͩʹ͍ͨ͠ • ͯͳϒϩάΛ৮ΒͣʹVSCodeͱGitHubͰԼॻ͖͔Βެ։·Ͱ͍݁ͤͨ͞ • ։ൃͱಉ͡Α͏ʹGitHub্ͷϒϥϯν࡞Pull RequestͰͯͳϒϩάͷ ࡞ɺߋ৽Λ͍ͨ͠
ԿΛΈ߹ΘͤΔ͔ʁ
GitHubͷΠϕϯττϦΨʔʹ GitHub Actions͕૬ੑ͕ྑ͍
ͯͳϒϩάͷૢ࡞
ͯͳϒϩάAtomPub https://developer.hatena.ne.jp/ja/documents/blog/apis/atom
ͯͳϒϩάAtomPub ϒϩάͷࢀরɺ࡞ɺެ։ɺআΛ REST APIͰՄೳ
͜ͷREST APIΛ͏OSSͳ͍͔ʁ
blogsync
• ͯͳBlog༻ͷCLIΫϥΠΞϯτ blogsync https://github.com/x-motemen/blogsync
͑ͦ͏ʂ
ϫʔΫϑϩʔΛ࡞ΔͨΊʹ blogsyncͷ༷Λཧղ͢Δ
ཧղ͢Δ༷ ϒϩάͷϑΥʔϚοτɺߘํ๏ɺߋ৽ํ๏ͷ3ͭ
ϒϩάͷϑΥʔϚοτ
blogsyncͷ༷ʢϒϩάͷϑΥʔϚοτʣ
ϒϩάͷߘํ๏
blogsyncͷ༷ʢϒϩάͷߘʣ
blogsyncͷ༷ʢϒϩάͷߘʣ
• ΤϯτϦߘඪ४ೖྗ͔Βड͚औΕΔ • Լॻ͖ͷςϯϓϨʔτΛdraft.mdͱ͓ͯ͘͜͠ͱͰɺҎԼίϚϯυͰ؆୯ʹϒ ϩάΛ࡞Ͱ͖Δ • $ blogsync post --draft
xxx.hatenablog.com < draft.md blogsyncͷ༷ʢϒϩάͷߘʣ
• blogsync post ίϚϯυΛ࣮ߦ͢ΔͱɺҎԼϑΝΠϧύεʹԼॻ͖ϒϩά͕ ग़དྷ্͕Δ • project_root/xxx.hatenablog.com/entry/yyyy/mm/dd/hhmmss.md • ྫɿ2022/01/02 03:04:05ʹίϚϯυΛ࣮ߦͨ͠߹ͷϒϩάͷϑΝΠϧύε
• project_root/xxx.hatenablog.com/entry/2022/01/02/030405.md blogsyncͷ༷ʢϒϩάͷߘʣ
ϒϩάͷߋ৽ํ๏
blogsyncͷ༷ʢϒϩάͷߋ৽ʣ
• PushίϚϯυͰͯͳϒϩάͷԼॻ͖Λߋ৽Ͱ͖Δ • ͨͩ͠ߋ৽ޙͷهࣄجຊతʹ৽͘͠࡞͞Εͯ͠·͏ blogsyncͷ༷ʢϒϩάͷߋ৽ʣ
Ͳ͏͍͏͜ͱʁ
• ϒϩάͷϑΝΠϧύε • project_root/xxx.hatenablog.com/entry/2022/01/02/030405.md • ͜ͷϒϩάΛฤू͠ɺཌblogsync push͢Δͱɺಉ͡༰Λ࣋ͭ৽͍͠ϒϩ ά͕ग़དྷ্͕Δ • project_root/xxx.hatenablog.com/entry/2022/01/02/030405.md
• project_root/xxx.hatenablog.com/entry/2022/01/03/040506.md blogsyncͷ༷ʢϒϩάͷߋ৽ʣ
ϫʔΫϑϩʔΛ࡞Δ্Ͱ ͓͖ͬͯ͘blogsyncͷ༷͜͜·Ͱ
ϫʔΫϑϩʔΛ࡞Δ
ϫʔΫϑϩʔ • ࠔͬͨ͜ͱཧܗΛݩʹɺҎԼ3ͭͷϫʔΫϑϩʔΛ࡞ • ϒϥϯν࡞࣌ʹͯͳϒϩάͷԼॻ͖Λ࡞ • Pull Request࣌ʹͯͳϒϩά্ͷԼॻ͖Λߋ৽ • ϥϕϧઃఆ࣌ʹϒϩάΛެ։
ͯͳϒϩάͷԼॻ͖࡞ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖࡞ ϫʔΫϑϩʔ 1.Create branch 2.Event trigger 3. Create blog 4.
Get blog 5. Commit blog GitHub Actions
ͯͳϒϩάͷԼॻ͖࡞ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖࡞ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖࡞ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖࡞ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖࡞ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖࡞ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖ߋ৽ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖ߋ৽ ϫʔΫϑϩʔ 1.Push blog 2.Pull Request 3. Update blog GitHub
Actions
ͯͳϒϩάͷԼॻ͖ߋ৽ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖ߋ৽ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖ߋ৽ ϫʔΫϑϩʔ
ͯͳϒϩάͷԼॻ͖ߋ৽ ϫʔΫϑϩʔ
৽نϒϩά͕࡞͞ΕΔ͕ ίϛοτ͠ͳ͍ ͯͳϒϩάͷԼॻ͖ߋ৽ ϫʔΫϑϩʔ
৽نϒϩά͕࡞͞ΕΔ͕ ίϛοτ͠ͳ͍ ͯͳϒϩάͷԼॻ͖ߋ৽ ϫʔΫϑϩʔ →ࣥචऀ͕ಉ͡ϑΝΠϧύ εͷϒϩάͰฤू͠ଓ͚Β ΕΔΑ͏ʹ͢ΔͨΊ
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ 3. Update blog 1.Approve label 2.Event trigger 4.
Get blog 5.Replace and Commit blog GitHub Actions
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ ɾgitͷཤྺΛอ࣋Ͱ͖Δ ɾϒϩάެ։ͱGitHub্ ͷϒϩάͷ࣌ͷϑΝΠϧ ύε͕Ұக͢Δ
ͯͳϒϩάͷެ։ ϫʔΫϑϩʔ
੍ݶࣄ߲ • GitHub্ͷԼॻ͖ϒϩάʹΞοϓϩʔυͨ͠ը૾Λɺͯͳϒϩάެ։Ͱ ͖ͳ͍ • ͯͳϒϩά্Ͱฤूͨ͠߹ɺGitHub্ͷϒϩάͱϚοϐϯάͰ͖ͳ ͍
·ͱΊ • GitHub ActionsͱblogsyncΛ༻ͯ͠ɺͯͳϒϩάͷهࣄ࡞ɺߋ৽ɺެ։ ΛࣗಈԽͨ͠ • ੍ݶࣄ߲͋Δͷͷɺ୯७Խ࡞ۀΛޮԽͰ͖ͨ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ