Save 37% off PRO during our Black Friday Sale! »

githubactions-potetotips.pdf

E8e70cb2d667e6d0752f89ee645e3f21?s=47 katsutomu
February 12, 2020

 githubactions-potetotips.pdf

E8e70cb2d667e6d0752f89ee645e3f21?s=128

katsutomu

February 12, 2020
Tweet

Transcript

  1. ࠓ೔͔Β࢝ΊΔ GithubActions

  2. ࣗݾ঺հ ❖ ؔࠜ ࠀయ @katsutomu ❖ ίωώτגࣜձࣾ / Android Engineer

    ❖ 2017/11/01ʹjoin ❖ ࠷ۙ͸TLͱͯ͠Ϛωδϝϯτ΋΍ͬͯ·͢
  3. ͖ΐ͏࿩͢͜ͱ ❖ Github Actions֓ཁ ❖ ϫʔΫϑϩʔͷղઆ ❖ ΞΫγϣϯͷղઆ ❖ ϚϚϦΞϓϦͰ΍͍ͬͯΔ͜ͱ

  4. Github Actions֓ཁ

  5. ֓ཁ ❖ GithubͷΠϕϯτΛτϦΨʔʹ͠ ͯɺಛఆͷϫʔΫϑϩʔΛ࣮ߦͰ ͖Δ ❖ ϫʔΫϑϩʔ͸Dockerίϯςφ্ ͰՔಇ͠ɺΞΫγϣϯΛ࣮ߦ͢Δ ❖ ΞΫγϣϯ͸ΞΫγϣϯ͸ҎԼͷ

    ΋ͷΛར༻Ͱ͖Δ ❖ ϦϙδτϦͰఆٛ͞Ε͍ͯΔΞΫγϣϯ ❖ GitHubͷOSSͷΞΫγϣϯ ❖ ެ։͞Ε͍ͯΔDockerίϯςφΠϝʔδ
  6. ϫʔΫϑϩʔͷղઆ

  7. ϫʔΫϑϩʔͱ͸ ❖ Ϗϧυɺςετɺύοέʔδɺ ϦϦʔεɺͳͲΛࣗಈԽ͢Δ ϓϩηε ❖ 1ͭҎ্ͷδϣϒ͔Βߏ੒͞ ΕɺΞΫγϣϯΛݺͼग़ͯ͠ ಛఆͷखଓ͖Λ࣮ߦ͢Δ ϫʔΫϑϩʔ

    Job1 Job2 Action Action Action Action Πϕϯτ
  8. ϫʔΫϑϩʔͷ࡞Γํ ❖ ϫʔΫϑϩʔΛτϦΨʔ͢ΔΠϕϯτΛࢦఆ ❖ ϫʔΫϑϩʔ಺Ͱ࣮ߦ͢Δδϣϒ/ΞΫγϣϯΛࢦఆ ❖ ͜ΕΒΛyamlͰهड़

  9. TopϨϕϧߏจ ❖ nameɿϫʔΫϑϩʔͷ໊લ ❖ onɿτϦΨʔ͢ΔΠϕϯτͷࢦఆ ❖ envɿ͢΂ͯͷjobɺstepͰ࢖༻͢Δ؀ڥม਺ ❖ jobsɿҰ࿈ͷ࡞ۀΛهड़͢Δ

  10. onߏจ ❖ onɿτϦΨʔ͢ΔΠϕϯτͷࢦఆ ❖ on.<event_name>.typesɿϑΟϧλʔ͢ΔΠϕϯτͷछ ྨΛࢦఆ ❖ on.<push|pull_request>.<branches|tags>ɿϑΟϧλʔ ͢Δϒϥϯν/λάͷࢦఆ

  11. ࢦఆͰ͖ΔΠϕϯτ ❖ WebhookΠϕϯτɿGithubͰൃੜͨ͠Πϕϯτ ❖ push/create/pull_request/etc… ❖ εέδϡʔϧΠϕϯτɿಛఆͷ࣌ؒʹ࣮ߦ͢ΔΠϕϯτ ❖ ֎෦ΠϕϯτɿGithub APIܦ༝Ͱ࣮ߦ͢ΔΠϕϯτ

  12. jobsߏจ ❖ jobs.<job_id>ɿδϣϒͷID ❖ jobs.<job_id>.nameɿδϣϒͷ໊લɻGithub্Ͱදࣔ͞ ΕΔ ❖ jobs.<job_id>.runs-onɿ࣮ߦ͞ΕΔԾ૝؀ڥΛࢦఆ ❖ jobs.<job_id>.stepsɿҰཡͷλεΫΛ·ͱΊͨ΋ͷ

    ❖ jobs.<job_id>.steps.usesɿ࣮ߦ͢ΔΞΫγϣϯͷࢦఆ
  13. ͜Μͳײ͡ʹͳΔ

  14. ͜Μͳײ͡ʹͳΔ ϫʔΫϑϩʔ Job1 Job2 Action Action Πϕϯτ Job3 Action

  15. ͜Μͳײ͡ Push͕ൃੜͨ࣌͠ʹ

  16. ͜Μͳײ͡ ࣮ߦ͢ΔҰ࿈ͷ jobΛࢦఆͯ͠

  17. ͜Μͳײ͡ job͝ͱʹ࣮ߦ͢Δ ؀ڥ/εςοϓΛࢦఆ

  18. ͜Μͳײ͡ ࣮ߦ͢ΔԾ૝؀ڥΛ ࢦఆ

  19. ͜Μͳײ͡ εςοϓ͝ͱʹ ΞΫγϣϯΛࢦఆ

  20. ͜Μͳײ͡ ॱ൪ʹδϣϒ͕ ࣮ߦ͞Εͯ ϫʔΫϑϩʔ͕׬ྃ͢Δ

  21. ΞΫγϣϯͷղઆ

  22. ΞΫγϣϯͱ͸ ❖ ΞΫγϣϯ͸ɺϫʔΫϑϩʔͷ࠷খͷߏ੒ཁૉ ❖ OSSͰڞ༗͞ΕΔΞΫγϣϯΛར༻͢Δ͜ͱ΍ಠࣗʹΞ ΫγϣϯΛ࡞Δ͜ͱ͕Մೳ ❖ ϫʔΫϑϩʔʹεςοϓͱؚͯ͠ΊͯΞΫγϣϯΛར༻ ͢Δ

  23. ΞΫγϣϯͷछྨ ❖ Dockerίϯςφ ❖ ΞΫγϣϯͷར༻ऀ͕πʔϧ΍ґଘؔ܎Λߟྀ͠ͳͯ͘ࡁΉ ❖ GitHubʹϗετ͞ΕͨLinux؀ڥͰΈ࣮ߦͰ͖·͢ɻ ❖ JavaScript ❖

    ࣮ߦʹ࢖༻͞ΕΔ؀ڥ͔Β੾Γ෼͚Δ͜ͱ͕Ͱ͖Δ ❖ GitHubʹϗετ͞ΕͨLinuxɺMacOSɺWindowsͷԾ૝Ϛ γϯͰՔಇ
  24. ΞΫγϣϯͷछྨ ❖ Dockerίϯςφ ❖ ΞΫγϣϯͷར༻ऀ͕πʔϧ΍ґଘؔ܎Λߟྀ͠ͳͯ͘ࡁΉ ❖ GitHubʹϗετ͞ΕͨLinux؀ڥͰΈ࣮ߦͰ͖·͢ɻ ❖ JavaScript ❖

    ࣮ߦʹ࢖༻͞ΕΔ؀ڥ͔Β੾Γ෼͚Δ͜ͱ͕Ͱ͖Δ ❖ GitHubʹϗετ͞ΕͨLinuxɺMacOSɺWindowsͷԾ૝Ϛ γϯͰՔಇ
  25. ϚϚϦΞϓϦͰͷΞΫγϣϯ ❖ ϦϙδτϦ಺ΞΫγϣϯ ❖ ϦϦʔεϒϥϯνΛpushͨ࣌͠ʹࣗಈͰPRΛ࡞Δ ❖ ϦϦʔεϒϥϯνΛϚʔδͨ࣌͠ʹࣗಈͰRelease NoteΛ࡞Δ ❖ OSSͷΞΫγϣϯ

    ❖ ϦϙδτϦͷcheckout ❖ SlackʹϦϦʔε಺༰ͷ௨஌Λ͢Δ
  26. ϫʔΫϑϩʔ ϫʔΫϑϩʔ createReleaseNote Checkout on PR event ❖ Ϛʔδͨ࣌͠ʹࣗಈͰRelease NoteΛ࡞Δ

    ❖ Step1. ϦϙδτϦΛνΣοΫΞ ΢τ ❖ Step2. ϦϦʔεϊʔτΛ࡞੒ ❖ ΞΫγϣϯͷத਎͸shell ϦϦʔεϊʔτ࡞੒
  27. ϫʔΫϑϩʔ

  28. ϫʔΫϑϩʔ masterϒϥϯν޲͚ͷ PR͕ด͡ΒΕͨ࣌ʹ

  29. ϫʔΫϑϩʔ ϦϙδτϦΛ νΣοΫΞ΢τͯ͠

  30. ϫʔΫϑϩʔ ϦϦʔεϊʔτ࡞੒༻ͷ ΞΫγϣϯΛ࣮ߦ

  31. ΞΫγϣϯ

  32. ΞΫγϣϯ ϦϦʔεϊʔτຊจΛઃఆ

  33. ΞΫγϣϯ PRͷΠϕϯτσʔλ͔Β ϨϙδτϦΛऔಘͯ͠

  34. ΞΫγϣϯ CURLͰGithubAPIΛୟ͖ ϦϦʔεϊʔτ࡞੒

  35. ΞΫγϣϯ Token͸ࣗಈͰ؀ڥม਺ʹ ηοτ͞Ε͍ͯΔ

  36. Ͱ͖ͨϦϦʔεϊʔτ

  37. Ͱ͖ͨϦϦʔεϊʔτ Github ActionsͰ ࡞ΒΕͯΔͶʂ

  38. ޻෉ͨ͜͠ͱ ϚʔδͰͳ͘Close࣌ʹ΋ τϦΨʔͯ͠͠·͏

  39. ޻෉ͨ͜͠ͱ ifΛ࢖ͬͯɺϚʔδ࣌ʹ ݶఆͨ͠

  40. ·ͱΊ ❖ ϫʔΫϑϩʔ͸ࣗಈԽϓϩηεͷҰ࿈ͷखଓ͖ ❖ ΞΫγϣϯ͸ݸʑʹ࣮ߦ͢ΔλεΫ ❖ OSS͔Βࢀর/ࣗ࡞͕Ͱ͖Δ ❖ ϚϚϦΞϓϦͰͷར༻ࣄྫ

  41. ͯ͞ɺ͜͜Ͱએ఻Ͱ͢ʂ

  42. ࠓճͷ಺༰ͱ͸શ͘ผ෺Ͱ͢

  43. ͜͜Ͱએ఻Ͱ͢ʂ ࣗ࡞ΞΫγϣϯΛެ։ͨͧ͠ʂ

  44. gradle-dependency-update-action ❖ ࠩ෼ͷ͋ΔgradleϑΝΠϧΛݩʹpull requestΛ࡞ͬͯ͘ ΕΔ ❖ Gradle Use Latest Versions

    Pluginͷར༻Λલఔ ❖ ·ͩ·ͩࡶͳ࡞ΓͰ͢ ❖ ྑ͔ͬͨΒࢼͯ͠Έ͍ͯͩ͘͞ʂ
  45. ͍ͤͪ͝ΐ͏͋Γ͕ͱ͏ ͍͟͝·ͨ͠

  46. Appendix ❖ yamlγϯλοΫε ❖ Πϕϯτͷछྨ ❖ https://github.com/katsutomu/gradle-dependency- update-action