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 full-size slide

  2. ࣗݾ঺հ
    • ࢁԼ խਓ

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

    • ࢓ࣄͷRailsྺ: 2೥ఔ౓

    • GitHub: @M-Yamashita01

    • Twitter: @M_Yamashii

    View full-size slide

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

    ZennͷهࣄΛݶఆެ։͢Δ

    View full-size slide

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

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

    View full-size slide

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

    View full-size slide

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

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

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

    View full-size slide

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

    ճ౴Λ௖͍ͨ

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

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

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  11. ͲΜͳํ๏͔ʁ

    View full-size slide

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


    ❯ npx zenn preview


    👀 Preview: http://localhost:8000


    View full-size slide

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

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

    View full-size slide

  14. ΊͬͪΌศརͦ͏ʂ

    View full-size slide

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

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

    View full-size slide

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

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

    ϓϨϏϡʔΛݟ͍ͨ

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

    ආ͚͍ͨ
    ՝୊

    View full-size slide

  17. ղܾͰ͖ΔΑ

    ͦ͏ɺGitHub ActionsͳΒͶ

    View full-size slide

  18. ߏ੒
    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 full-size slide

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

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

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

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

    • Pull Request close

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

    View full-size slide

  20. ಈ࡞݁Ռ (Pull Request open)

    View full-size slide

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

    View full-size slide