cloudtype 을 사용해서 만든 앱을 인터넷에 배포해보자 !

feature/ 로 시작하는 브랜치를 만들어서 test코드를 포함한 수정 작업을 완료한 뒤 Pull Request 생성gradle test 수행cloudtype 서버에 배포
이전 게시글과 동일하게 CI를 먼저 구축해보자 !
#test-pr.yml
name: test every pr
on:
workflow_dispatch:
pull_request:
permissions:
contents: read
pull-requests: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: setup jdk
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: gradlew test
run: ./gradlew test
#deploy-main.yml
name: Deploy to cloudtype
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Connect deploy key
uses: cloudtype-github-actions/connect@v1
with:
token: ${{ secrets.CLOUDTYPE_TOKEN }}
ghtoken: ${{ secrets.GHP_TOKEN }}
- name: Deploy
uses: cloudtype-github-actions/deploy@v1
with:
token: ${{ secrets.CLOUDTYPE_TOKEN }}
project: # 워크스페이스 이름/프로젝트 이름 ex) nbc.docker/cicd
stage: main
yaml: |
name: # 프로젝트 이름 ex) `cicd`
app: java@17
options:
ports: 8080
context:
git:
url: git@github.com:${{ github.repository }}.git
ref: ${{ github.ref }}
preset: java-springboot

1️⃣ GitHub Personal Token 발급
2️⃣ cloudtype 의 API Key 발급

3️⃣ 배포 서비스 생성


4️⃣ github 설정
- 해당 repository Settings -> Security -> Secrets and variables -> Actions
- GitHub Personal token: GHP_TOKEN
- cloudtype API key: CLOUDTYPE_TOKEN
- Repository secrets에서 설정

5️⃣ Workspace와 프로젝트 이름 설정

6️⃣ 설정 후 Actions에서 정상적으로 배포된 것을 확인

7️⃣ cloudtype에서 배포 완료 된 것을 확인


출처 : [TeamSparta]