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
yuki
January 13, 2022
Programming
0
310
脱初心者のための GitHub Actions
「GitHub Actionsって聞いたことあるけど、よく理解していない」
「知ってるけど使ったことない」
という方向けの内容です。
yuki
January 13, 2022
Tweet
Share
More Decks by yuki
See All by yuki
誰のためのコメント? / comments-for-whom
yyykms123
0
97
今年の抱負 2024/Aspirations for 2024
yyykms123
0
170
Vercel Ship まとめ「2023/5/1-5」
yyykms123
0
160
プロジェクト管理で失敗したこと
yyykms123
0
47
プロジェクトをリリースするまでのプロセス
yyykms123
0
42
実務で使えるGitコマンド
yyykms123
4
1.1k
過去の自分へ送るLT!
yyykms123
0
86
Other Decks in Programming
See All in Programming
もうちょっといいRubyプロファイラを作りたい (2025)
osyoyu
0
400
時間軸から考えるTerraformを使う理由と留意点
fufuhu
15
4.6k
250830 IaCの選定~AWS SAMのLambdaをECSに乗り換えたときの備忘録~
east_takumi
0
380
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
210
アセットのコンパイルについて
ojun9
0
120
複雑なドメインに挑む.pdf
yukisakai1225
5
1.1k
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
630
CloudflareのChat Agent Starter Kitで簡単!AIチャットボット構築
syumai
2
460
RDoc meets YARD
okuramasafumi
4
170
AIでLINEスタンプを作ってみた
eycjur
1
230
Android端末で実現するオンデバイスLLM 2025
masayukisuda
1
120
AWS発のAIエディタKiroを使ってみた
iriikeita
1
180
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.6k
Designing for Performance
lara
610
69k
Embracing the Ebb and Flow
colly
87
4.8k
The World Runs on Bad Software
bkeepers
PRO
70
11k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Art, The Web, and Tiny UX
lynnandtonic
302
21k
Fireside Chat
paigeccino
39
3.6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
4 Signs Your Business is Dying
shpigford
184
22k
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