Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GitHub ActionsでZennの記事を限定公開する

GitHub ActionsでZennの記事を限定公開する

Fukuoka.rb 0x100 回 LT 大会 (#256)での登壇資料です。
https://fukuokarb.connpass.com/event/245647/

M-Yamashita

May 11, 2022
Tweet

More Decks by M-Yamashita

Other Decks in Programming

Transcript

  1. 2022-05-11 Fukuoka.rb 0x100 ճ LT େձ
    GitHub ActionsͰZennͷهࣄΛݶఆެ։͢Δ
    M-Yamashita

    View Slide

  2. ࣗݾ঺հ
    • ࢁԼ խਓ

    • όοΫΤϯυΤϯδχΞ@෱Ԭ

    • ࢓ࣄͷRailsྺ: 2೥ఔ౓

    • GitHub: @M-Yamashita01

    • Twitter: @M_Yamashii

    View Slide

  3. ࿩͢͜ͱ
    GitHub Actions + Cloud RunͰ

    ZennͷهࣄΛݶఆެ։͢Δ

    View Slide

  4. ॻ͍ͨهࣄΛಛఆͷਓ͚ͨͪͩʹݟ͍ͤͨʂ

    ͦΜͳܦݧ͋Γ·ͤΜ͔ʁ
    ͬͦ͘͞Ͱ͕͢

    View Slide

  5. ࢲ͸࠷ۙͦͷܦݧʹग़ձ͍·ͨ͠

    View Slide

  6. • ओʹZennΛ࢖͍Ruby΍RailsͳͲʹؔ͢ΔهࣄΛΞοϓ͖ͯͨ͠

    • Zennʹ౤ߘ͖ͯͨ͠هࣄ͸ɺެࣜαΠτ΍ެ։͞Ε͍ͯΔ৘ใ͔Β

    ݸਓͰௐࠪ͠·ͱΊͨ΋ͷ͕΄ͱΜͲ
    ࠓ·Ͱ

    View Slide

  7. • ٕज़هࣄͷࣥචʹ͋ͨΓɺଞͷํʹެࣜϦϑΝϨϯεʹؔ͢Δ࣭໰Λͯ͠

    ճ౴Λ௖͍ͨ

    • ZennͰهࣄΛॻ্͖͕͛ͨɺެ։લʹΞυόΠεΛͯ͘͠Εͨਓ͚ͩʹ

    ؒҧ͍౳ͳ͍͔ݟͯ΋Β͍͍ͨ

    • Zennʹ͸ݶఆެ։ͷػೳ͕ͳͦ͞͏ʢ2022/05/03 ຊࢿྉ࡞੒࣌఺ʣ
    ͖͔͚ͬ

    View Slide

  8. Ͳ͏ʹ͔ͯ͠ݶఆެ։Ͱ͖ͳ͍͔ʁ

    View Slide

  9. ࣗ෼ͷଞʹ΋ݶఆެ։Λߟ͑ͨਓ͕͍Δ͸ͣ

    View Slide

  10. View Slide

  11. https://zenn.dev/e_koma/articles/20210104-zenn-preview

    View Slide

  12. ͜Εͩʂ

    View Slide

  13. ͲΜͳํ๏͔ʁ

    View Slide

  14. લఏɿZennͷCLI͔ΒϓϨϏϡʔΛදࣔ
    ~/xxxxx/M-Yamashita01/zenn-article


    ❯ npx zenn preview


    👀 Preview: http://localhost:8000


    View Slide

  15. ঺հ͞Ε͍ͯͨݶఆެ։ͷํ๏
    Container

    Registry
    Cloud Run
    Push Image
    Deploy Use Image
    Access
    Docker
    fi
    le
    ENTRYPOINT ["npx", "zenn", "preview"]
    https://xxxxx.a.run.app

    View Slide

  16. ΊͬͪΌศརͦ͏ʂ

    View Slide

  17. ͜ͷํ๏Λ࢖ͬͨͱ͖ʹ

    ՝୊͕͍͔ͭ͘ग़͖ͯͨ

    View Slide

  18. • ෳ਺ͷίϚϯυΛखಈ࣮ߦ͢Δͷ͸ख͕͔͔ؒΔ

    • ZennͱGitHubΛ࿈ܞࡁΈͳͷͰɺهࣄ࡞੒ͷPull RequestΛτϦΨʔʹ

    ϓϨϏϡʔΛݟ͍ͨ

    • ϓϨϏϡʔʹ࢖ͬͨCloud RunͷαʔϏε΍ίϯςφΠϝʔδͷফ͠๨ΕΛ

    ආ͚͍ͨ
    ՝୊

    View Slide

  19. ղܾͰ͖ΔΑ

    ͦ͏ɺGitHub ActionsͳΒͶ

    View Slide

  20. ߏ੒
    Container

    Registry
    Cloud Run
    Push article
    Deploy
    Access
    GitHub
    Actions
    Pull Request Push image
    Use Image
    https://xxxxx.a.run.app
    Post preview url

    View Slide

  21. • Pull RequestͷopenɺpushʹΑΔߋ৽

    • طଘͷίϯςφΠϝʔδɺCloud RunͷαʔϏεΛ࡟আ

    • Container Registry΁ΠϝʔδϓογϡɺCloud RunʹσϓϩΠ

    • σϓϩΠ׬ྃޙʹϓϨϏϡʔͷURLΛPull Requestʹ౤ߘ

    • Pull Request close

    • طଘͷίϯςφΠϝʔδɺCloud RunͷαʔϏεΛ࡟আ
    ϫʔΫϑϩʔ

    View Slide

  22. ಈ࡞݁Ռ (Pull Request open)

    View Slide

  23. ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ

    View Slide