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
dev.toの記事もGitHubで管理してみた
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
YouYou
May 14, 2022
Technology
2.3k
0
Share
dev.toの記事もGitHubで管理してみた
詳細ブログ↓
https://zenn.dev/yuta28/articles/dev-github-vscode
YouYou
May 14, 2022
More Decks by YouYou
See All by YouYou
AWSマネコンに複数のアカウントで入れるようになりました
yuhta28
2
270
今インフラ技術をイチから学び直すなら
yuhta28
1
280
AWSに詳しくない人でも始められるコスト最適化ガイド
yuhta28
3
660
Datadog外形監視基盤をEC2から ECSへ移行してみた
yuhta28
0
1.8k
アウトプット頑張ったら企業からLT登壇の依頼がきた話
yuhta28
1
1.8k
小さなことから始めるAWSコスト最適入門
yuhta28
1
1.4k
Datadogのコストも監視しよう
yuhta28
1
1k
Rcloneを使った定期的なストレージ同期
yuhta28
0
810
Pulumiを触ってみよう
yuhta28
1
2.7k
Other Decks in Technology
See All in Technology
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
AIにより大幅に強化された AWS Transform Customを触ってみる
0air
0
230
Sansanの認証基盤を支えるアーキテクチャとその振り返り
sansantech
PRO
1
120
遊びで始めたNew Relic MCP、気づいたらChatOpsなオブザーバビリティボットができてました/From New Relic MCP to a ChatOps Observability Bot
aeonpeople
1
130
【AWS】CloudTrail LakeとCloudWatch Logs Insightsの使い分け方針
tsurunosd
0
130
AWS Systems Managerのハイブリッドアクティベーションを使用したガバメントクラウド環境の統合管理
toru_kubota
1
190
AWS DevOps Agent or Kiro の使いどころを考える_20260402
masakiokuda
0
120
The essence of decision-making lies in primary data
kaminashi
0
190
Zephyr(RTOS)でOpenPLCを実装してみた
iotengineer22
0
170
FASTでAIエージェントを作りまくろう!
yukiogawa
4
180
Why we keep our community?
kawaguti
PRO
0
350
Kubernetesの「隠れメモリ消費」によるNode共倒れと、Request適正化という処方箋
g0xu
0
170
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
150
Discover your Explorer Soul
emna__ayadi
2
1.1k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
97
GitHub's CSS Performance
jonrohan
1032
470k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
96
GraphQLとの向き合い方2022年版
quramy
50
14k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
92
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
440
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
230
Typedesign – Prime Four
hannesfritz
42
3k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Transcript
dev.toの記事もGitHubで管理し てみた 1
Name:ユータ Occupation:SRE Twitter:@Y0u281 (オーでなくゼロです) ブログ:https://zenn.dev/yuta28 自己紹介 Twitter 2
目次 • 背景 • dev.toについて • dev.to管理用テンプレートリポジトリ • dev.toとGitHubとの連携 •
まとめ 3
背景 • Zennでブログ執筆中 ◦ GitHub Actionsを使って記事の自動投稿を実現 • dev.toでも同じように自動投稿を実現したい • すでに実践している人がいたので参考にしてみた
詳しくはこちら↓ GitHub ActionsでZennブログの 校正を自動化してみた 4
dev.toについて • 英語版Qiitaみたいなもの • 爆速であることで有名 ◦ 阿部寛さんのHPとどちらが速いか比較されたこともある • スマホアプリ版もある DEV
is a community of software developers getting together to help one another out. The software industry relies on collaboration and networked learning. We provide a place for that to happen. Aboutページより引用 5
dev.to管理用テンプレートリポジトリ 以下のリポジトリをコピーしてもらえたら皆さんもdev.toの記事をGitHubで管理できま す。 https://github.com/Yuhta28/dev-to-blog-template 6
DEV Community APIキー生成 GitHubにセットするAPIキー DEV API (beta) | Forem Docs
APIはベータ版なのか若干動作不安 7
GitHub Actions用の変数セット 先ほど生成したAPIキーをセット 8
GitHub Actionsワークフロー設定 deploy: # 長いので記事投稿部分のみ抜粋 name: Deploy if: github.ref == 'refs/heads/main'
&& github.event_name == 'push' runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@master - name: Install Dependencies uses: bahmutov/npm-install@v1 - name: Deploy to dev.to run: DEV_TO_GIT_TOKEN=${{ secrets.DEV_TO_GIT_TOKEN }} yarn run dev-to-git Yarnパッケージ ↑参照 dev-to-gitにAPIキーを渡す 9
記事の初期作成 dev.toのAPIリクエストで作成する curl -X POST -H "Content-Type: application/json" \ -H
"api-key: API_KEY" \ -d \ '{"article":{"title":"Template","body_markdown":"Body","published":false,"tags":["tag1", "tag2"]}}' https://dev.to/api/articles 環境変数でセット 10 Goで作った
記事の初期作成 ドラフト記事作成 この記事のIDを取得する 11
記事IDの取得 curl -H "api-key: API_KEY" https://dev.to/api/articles/me/(un)published | \ jq '.[].id'
プログラミング言語でも取得できますが、一部の言語では取得できませんでした。 例:Python dev-to-git.json 12
記事の校正 簡単な誤字脱字はtextlintと reviewdogでCI時に自動検知 13
記事のデプロイ 14
記事のデプロイ 15
まとめ • ブログもGitHubで管理 • 好きなエディターで記事を書こう • GitHub Actionsはいいぞ! 16
ありがとうございました より詳しい内容は以下のブログで↓ dev.toの記事もGitHubで管理してみた (zenn.dev) 17