$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
脱初心者のための GitHub Actions
Search
yuki
January 13, 2022
Programming
0
320
脱初心者のための GitHub Actions
「GitHub Actionsって聞いたことあるけど、よく理解していない」
「知ってるけど使ったことない」
という方向けの内容です。
yuki
January 13, 2022
Tweet
Share
More Decks by yuki
See All by yuki
誰のためのコメント? / comments-for-whom
yyykms123
0
100
今年の抱負 2024/Aspirations for 2024
yyykms123
0
180
Vercel Ship まとめ「2023/5/1-5」
yyykms123
0
160
プロジェクト管理で失敗したこと
yyykms123
0
49
プロジェクトをリリースするまでのプロセス
yyykms123
0
44
実務で使えるGitコマンド
yyykms123
4
1.2k
過去の自分へ送るLT!
yyykms123
0
88
Other Decks in Programming
See All in Programming
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
480
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
160
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
270
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
130
dotfiles 式年遷宮 令和最新版
masawada
1
770
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
6
2.2k
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
11
11k
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
220
大体よく分かるscala.collection.immutable.HashMap ~ Compressed Hash-Array Mapped Prefix-tree (CHAMP) ~
matsu_chara
2
220
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
18
7.4k
ハイパーメディア駆動アプリケーションとIslandアーキテクチャ: htmxによるWebアプリケーション開発と動的UIの局所的適用
nowaki28
0
420
FluorTracer / RayTracingCamp11
kugimasa
0
230
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
Making Projects Easy
brettharned
120
6.5k
We Have a Design System, Now What?
morganepeng
54
7.9k
Producing Creativity
orderedlist
PRO
348
40k
Rails Girls Zürich Keynote
gr2m
95
14k
GraphQLとの向き合い方2022年版
quramy
50
14k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Music & Morning Musume
bryan
46
7k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
Building Adaptive Systems
keathley
44
2.9k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.3k
For a Future-Friendly Web
brad_frost
180
10k
Transcript
ॳ৺ऀͷͨΊͷ GitHub Actions ϛϥΠτσβΠϯ / ϖνΦϒ 2021.08.12 / Yukimasa Ikeda
ࣗݾհ • ా ༗ًক / Yukimasa Ikeda • 1994ੜ·Ε ਆಸݝԣࢢग़
• 2015/04ʙ2018/12 ધһ • 2019/06ʙ2021/08 ΤϯδχΞ • Rails, iOS, Android, Laravel, React, Next.js
ࠓճͷର • GitHub Actionsͬͯฉ͍ͨ͜ͱ͋Δ͚Ͳɺ Α͘ཧղ͍ͯ͠ͳ͍ • GitHub ActionsͬͯΔ͚Ͳͬͨ͜ͱ͕ ͳ͍
͢༰ 1. GitHub Actionsͱʁ 2. GitHub Actionsͷ͍ํ 3. ࣮ࡍʹಈ͔ͯ֬͠ೝͯ͠ΈΔ
GitHub Actionsͱʁ
GitHub Actionsͱʁ 6 • CI/CDͷαʔϏε • ϦϙδτϦͱ࿈ܞ͠ɺϏϧυɾ ςετɾσϓϩΠΛࣗಈԽͤ͞Δ •
GitHubͷϑΝʔετύʔςΟ ͳͷͰIssuePRͱͷ࿈ܞ͕Մೳ GitHub Actionsͷಛ
GitHub Actionsͱʁ 7 GitHub Actionsͷྉۚ
GitHub Actionsͱʁ 8 GitHub Actionsͷྉۚ
ΫϥυܕCI/CDαʔϏεͷਓؾͷൺֱ
GitHub Actionsͷ͍ํ
GitHub Actionsͷ͍ํ ϫʔΫϑϩʔΛઃఆ͢Δ
GitHub Actionsͷ͍ํ 12 ϫʔΫϑϩʔͱʁ • ϏϧυɾςετɾσϓϩΠͳͲɺͦͷଞϦϙδτϦͰԿ͔͠Βࣗಈ Խ͞Εͨϓϩηε • pushPRɺWebhookΛ༻ͨ͠֎෦ΠϕϯτͳͲΛτϦΨʔʹಈ࡞ ͢Δ
• Կ͔͠ΒͷλεΫΛ࣮ߦ͢Δδϣϒ͔Βߏ͞ΕΔ • YAMLܗࣜͰઃఆϑΝΠϧΛ࡞͢Δ
GitHub Actionsͷ͍ํ 13 ϫʔΫϑϩʔͷ࡞ • ϦϙδτϦʹ .github/workflows ͱ͍͏σΟϨΫτϦΛ࡞͠ɺ ͦͷԼʹ .yml
͔ .yaml ͱ͍͏֦ுࢠͰϫʔΫϑϩʔͷઃఆϑΝ ΠϧΛ࡞ • ϑΝΠϧ໊ࣗ༝ • ϫʔΫϑϩʔ͝ͱʹෳϑΝΠϧΛ࡞͢Δ͜ͱՄೳ
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v GitHub Actionsެࣜͷαϯ ϓϧͷϫʔΫϑϩʔ GitHub Actionsͷ͍ํ ެࣜͷwork fl ow
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v GitHubϦϙδτϦʹදࣔ͞ ΕΔϫʔΫϑϩʔͷ໊લɻ লུՄೳͰɺলུ͢Δͱ૬ ରύε໊͕લͱͳΔɻ GitHub Actionsͷ͍ํ name:
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ඞਢ τϦΨʔͱͳΔΠϕϯτͷ ໊લɻ 1ͭͷΠϕϯτ͘͠ෳ ͷΠϕϯτΛࢦఆ͢Δ͜ͱ ͕Ͱ͖Δɻ GitHub Actionsͷ͍ํ on:
name: learn-github-actions on: [push, pull_request ] jobs : check-bats-version :
runs-on: ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ෳͷ߹ྻͰࢦఆ͢ Δ͜ͱ͕Մೳɻ GitHub Actionsͷ͍ํ on:
name: learn-github-actions on : push : branches : - main
pull_request : branches : - main jobs : check-bats-version : runs-on: ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v Πϕϯτ͝ͱʹઃఆΛߦ͏ ߹ɺͦΕͧΕͷΠϕϯ τʹରͯ͠ઃఆ͢Δඞཁ͕ ͋Δɻ ઃఆ͕ͳ͍ΠϕϯτؚΊ ίϩϯʢ:ʣΛՃ͢Δ GitHub Actionsͷ͍ํ on:
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ϫʔΫϑϩʔϑΝΠϧͰ࣮ ߦ͞ΕΔશͯͷδϣϒΛά ϧʔϓԽ͢Δɻ sampleͰ check-bats-versio n ͱ͍͏໊લͷJobΛ1͚ͭͩ ఆ͍ٛͯ͠Δɻ GitHub Actionsͷ͍ํ jobs:
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ඞਢ ԾϚγϯͷࢦఆɻ sanpleͰUbuntu LinuxͰ ࣮ߦ͢ΔΑ͏ʹઃఆΛͯ͠ ͍Δ GitHub Actionsͷ͍ํ run-on:
αϙʔτ͞Ε͍ͯΔԾϚγϯ
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v ίϚϯυΛ࣮ߦͰ͖Δλε Ϋɻ Կ͔͠ΒͷίϚϯυΛ࣮ߦ ͢Δ͔ɺԿ͔͠ΒͷΞΫ γϣϯΛݺͼग़͢ɻ usesΞΫγϣϯɺ runίϚϯυΛࢦఆ͢Δɻ GitHub Actionsͷ͍ํ steps:
GitHub Actionsͷ͍ํ 23 Action • StepΛߏ͢Δ࠷খ୯ҐͰɺԿ͔͠ΒͷॲཧͷմΛද͢ • GitHub Actions͕ఏڙ͍ͯͨ͠ΓɺಠࣗͷΞΫγϣϯΛ࡞͢Δ͜ͱ͕Ͱ ͖Δ
• ύϒϦοΫϦϙδτϦDockerϨδετϦͰެ։͞ΕͨΞΫγϣϯΛ࣮ߦ ͢Δ͜ͱ͕Ͱ͖Δ
name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on:
ubuntu-latest steps : - name: First step uses: actions/checkout@v 2 - name: Setup node uses: actions/setup-node@v 1 - name: Install bats run: npm install -g bat s - name: Bats version run: bats -v stepGitHubͰදࣔ͞ΕΔ ໊લΛ͚ͭΔ͜ͱ͕Ͱ͖ Δɻ GitHub Actionsͷ͍ํ steps:
GitHubͷActionsͰ֬ೝ͢Δͱ໊લ͕͍͍ͭͯΔ
࣮ࡍʹαϯϓϧΛ࣮ߦͯ͠ΈΑ͏ʂ
ϦϙδτϦΛ࡞࣮ͯ͠ࡍʹ֬ೝͯ͠ΈΔ # ϦϙδτϦΛ࡞ $ mkdir github-actions-sampl e $ cd github-actions-sampl
e # ࢦఆͷσΟϨΫτϦΛ࡞ $ mkdir -p .github/workflow s # ϫʔΫϑϩʔΛ࡞ $ vi .github/workflows/learn-github-actions.ym l # pushͯ͠ActionsΛ֬ೝ͢Δ $ git ini t $ git add . $ git commit -m "Initial commit " $ git remote add origin [ϦϙδτϦurl ] $ git push -u origin main name: learn-github-actions on: [push ] jobs : check-bats-version : runs-on: ubuntu-latest steps : - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g bats - run: bats -v
·ͱΊ
·ͱΊ 29 GitHub Actionsͱʁ • ϦϙδτϦͱ࿈ܞͯ͠ɺϏϧυɾςετɾσϓϩΠͳͲͦͷଞ༷ʑͳ ϓϩηεΛࣗಈԽͤ͞ΔCI/CDͷαʔϏε • όϒϦοΫϦϙδτϦແྉɺϓϥΠϕʔτϦϙδτϦҰ෦ແྉͰ ༻Մೳ
• YAMLܗࣜͷϫʔΫϑϩʔΛ࡞͢Δ͚ͩͰ࣮ߦՄೳ
Thank you! yukimasa @yyykms123