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
87
今年の抱負 2024/Aspirations for 2024
yyykms123
0
170
Vercel Ship まとめ「2023/5/1-5」
yyykms123
0
150
プロジェクト管理で失敗したこと
yyykms123
0
43
プロジェクトをリリースするまでのプロセス
yyykms123
0
41
実務で使えるGitコマンド
yyykms123
4
1.1k
過去の自分へ送るLT!
yyykms123
0
86
Other Decks in Programming
See All in Programming
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
160
Team operations that are not burdened by SRE
kazatohiei
1
190
DroidKnights 2025 - 다양한 스크롤 뷰에서의 영상 재생
gaeun5744
3
320
#kanrk08 / 公開版 PicoRubyとマイコンでの自作トレーニング計測装置を用いたワークアウトの理想と現実
bash0c7
1
340
生成AIで日々のエラー調査を進めたい
yuyaabo
0
640
C++20 射影変換
faithandbrave
0
530
XP, Testing and ninja testing
m_seki
3
180
設計やレビューに悩んでいるPHPerに贈る、クリーンなオブジェクト設計の指針たち
panda_program
6
1.3k
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
1
680
Enterprise Web App. Development (2): Version Control Tool Training Ver. 5.1
knakagawa
1
120
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
330
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
380
Featured
See All Featured
KATA
mclloyd
29
14k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Fireside Chat
paigeccino
37
3.5k
Facilitating Awesome Meetings
lara
54
6.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
Why You Should Never Use an ORM
jnunemaker
PRO
56
9.4k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
The Cult of Friendly URLs
andyhume
79
6.5k
Writing Fast Ruby
sferik
628
61k
Site-Speed That Sticks
csswizardry
10
660
A designer walks into a library…
pauljervisheath
206
24k
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