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
300
脱初心者のための GitHub Actions
「GitHub Actionsって聞いたことあるけど、よく理解していない」
「知ってるけど使ったことない」
という方向けの内容です。
yuki
January 13, 2022
Tweet
Share
More Decks by yuki
See All by yuki
今年の抱負 2024/Aspirations for 2024
yyykms123
0
110
Vercel Ship まとめ「2023/5/1-5」
yyykms123
0
90
プロジェクト管理で失敗したこと
yyykms123
0
34
プロジェクトをリリースするまでのプロセス
yyykms123
0
37
実務で使えるGitコマンド
yyykms123
4
1.1k
過去の自分へ送るLT!
yyykms123
0
82
Other Decks in Programming
See All in Programming
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
140
Quine, Polyglot, 良いコード
qnighy
4
650
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
200
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Outline View in SwiftUI
1024jp
1
340
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
Contemporary Test Cases
maaretp
0
140
flutterkaigi_2024.pdf
kyoheig3
0
170
Welcome JSConf.jp 2024
yosuke_furukawa
PRO
0
130
CSC509 Lecture 12
javiergs
PRO
0
160
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
180
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
Featured
See All Featured
Music & Morning Musume
bryan
46
6.2k
We Have a Design System, Now What?
morganepeng
50
7.2k
GraphQLとの向き合い方2022年版
quramy
43
13k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Visualization
eitanlees
145
15k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Building Adaptive Systems
keathley
38
2.3k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
GitHub's CSS Performance
jonrohan
1030
460k
Fireside Chat
paigeccino
34
3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
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