Skip to content

Latest commit

ย 

History

History
90 lines (54 loc) ยท 2.55 KB

ACTIONS-HEROKU.md

File metadata and controls

90 lines (54 loc) ยท 2.55 KB

Actions + Heroku

  1. https://start.spring.io/ ์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์„ธํŒ…ํ•ด์„œ ์—ด์–ด์ค€๋‹ค. (ํ˜น์€ ๊ฐœ์ธ ํ”„๋กœ์ ํŠธ)

    (ํ• ๋•Œ๋งˆ๋‹ค ๊นŒ๋จน์–ด์„œ ๋˜ ์ ์œผ๋ฉด Group๋Š” ํŒจํ‚ค์ง€๋ช…์ด๊ณ , Artifact๋Š” ๋นŒ๋“œ๋ช…์ด๋‹ค.)



  2. Heroku ๊ณต์‹ ํ™ˆํŽ˜์ด์ง€์˜ ๊ฐ€์ด๋“œ๋ฅผ ๋”ฐ๋ผ๊ฐ„๋‹ค.

    https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku

    • Procfile ํŒŒ์ผ ๋งŒ๋“ค๊ธฐ (ํ™•์žฅ์ž ์—†์Œ)

      ๋‚ด์šฉ์€

      • [๋นŒ๋“œ๋ช…] ์€ ์œ„์—์„œ ์ •ํ•œ ๊ฒƒ
      • [version] ์€ build.gradle์— version์ด๋‹ค.
      web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/[๋นŒ๋“œ๋ช…]-[version].jar
      
    • system.properties ํŒŒ์ผ ๋งŒ๋“ค๊ธฐ (ํ•„์ˆ˜๋Š” ์•„๋‹˜)

      https://devcenter.heroku.com/articles/java-support ๋ฅผ ๋ณด๋ฉด, heroku๊ฐ€ ์ž๋ฐ”๋ฅผ ์ง€์›ํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค.

      java.runtime.version=11
      
    • gradlew๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, /gradle/wrapper ํด๋”๋Š” gitignore๋กœ ๋นผ๋ฒ„๋ฆฌ๋ฉด ์•ˆ๋œ๋‹ค.



  3. heroku ํšŒ์›๊ฐ€์ž…์„ ํ•˜๊ณ  ์•ฑ์„ ๋งŒ๋“ค์ž.

    https://dashboard.heroku.com/apps ์—์„œ new๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.



  4. ์ด์ œ ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— Actionsํƒญ > 'set up a workflow yourself'๋ฅผ ์„ ํƒํ•˜์ž.

    (์ด๋ฏธ ๋งŒ๋“ ์  ์žˆ๋‹ค๋ฉด New workflow)

    image

    ๊ทธ๋Ÿฌ๋ฉด ๋ฃจํŠธ์— .github/workflows ๋ผ๋Š” ํด๋”๊ฐ€ ์ƒ๊ฒผ์„ ๊ฒƒ์ด๋‹ค. ๊ฑฐ๊ธฐ์— ์žˆ๋Š” ymlํŒŒ์ผ์˜ ๋‚ด์šฉ์— heroku ๊ฐ’๋“ค์„ ๋„ฃ์–ด์ฃผ์ž.

    name: [์›ํ•˜๋Š” ์ด๋ฆ„]
    
    on:
      push:
        branches: [ main ]
    
    jobs:
      build:
        runs-on: ubuntu-latest    # ๋Œ๋ฆด OS
        
        steps:
          - uses: actions/checkout@v2
          
    #      - name: Build project    # ๋กœ์ปฌ์—์„œ buildํ•ด์„œ ํ™•์ธํ•˜๊ณ  ๋ฐฐํฌํ•  ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ด๊ฑด ๊ตณ์ด ํ•„์š”๋Š” ์—†์Œ 
    #        run: ./gradlew build
      
          - name: Deploy to Heroku
            uses: AkhileshNS/[email protected]
            with:
              heroku_api_key: ${{ secrets.heroku_api_key }}
              heroku_email: ${{ secrets.heroku_email }}
              heroku_app_name: ${{ secrets.heroku_app_name }}
    • heroku_api_key
    • heroku_email
    • heroku_app_name

    ๊ฐ’๋งŒ ๋„ฃ์œผ๋ฉด ๋˜๋Š”๋ฐ, ์ด๊ฑฐ๋Š” Settingsํƒญ > Secrets์—์„œ ๊ฐ’์„ ์ˆจ๊ฒจ์„œ ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉํ•˜์ž.

    (api_key๋Š” Account Settings์˜ ๋งจ ๋ฐ‘์— ์žˆ๋‹ค.)