Skip to content

Latest commit

ย 

History

History
138 lines (115 loc) ยท 3.84 KB

File metadata and controls

138 lines (115 loc) ยท 3.84 KB


Cloudtype



ํด๋ผ์šฐ๋“œํƒ€์ž… ์›จ๋น„๋‚˜ #01
GitHub Actions๋ฅผ ํ™œ์šฉํ•œ CI/CD ํŒŒ์ดํ”„๋ผ์ธ ๊ตฌ์ถ•ํ•˜๊ธฐ

๋ชฉ์ฐจ

๐Ÿ› ๏ธ ์ค€๋น„์‚ฌํ•ญ

โš™๏ธ GitHub Actions Workflows

๋ฐฐํฌ๋œ React ์•ฑ์— GitHub Actions ์ ์šฉํ•˜๊ธฐ

name: Deploy to cloudtype
on:
  push:
    branches:
      - main
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - 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: [์ŠคํŽ˜์ด์Šค๋ช…]/[ํ”„๋กœ์ ํŠธ๋ช…]
          stage: main
          yaml: |
            name: [์„œ๋น„์Šค๋ช…]
            app: web
            options:
              docbase: /build
              nodeversion: 14
              spa: true
            context:
              git:
                url: [email protected]:${{ github.repository }}.git
                ref: ${{ github.ref }}
              preset: react

ํ”„๋ผ์ด๋น— ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์ด๋ฏธ์ง€ ๋ฐฐํฌํ•˜๊ธฐ - GitHub Container Registry

name: Create and publish a Docker image, Deploy to Cloudtype

on:
  push:
    branches:
      - main

env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

jobs:
  build-and-push-image:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Log in to the Container registry
        uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GHP_TOKEN }}

      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
          tags: |
            type=sha

      - name: Build and push Docker image
        uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
        with:
          context: .
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

      - name: Deploy to Cloudtype
        uses: cloudtype-github-actions/deploy@v1
        with:
          token: ${{ secrets.CLOUDTYPE_TOKEN }}
          project: [์ŠคํŽ˜์ด์Šค๋ช…]/[ํ”„๋กœ์ ํŠธ๋ช…]
          stage: main
          yaml: |
            name: [์„œ๋น„์Šค๋ช…]
            app: container
            options:
              ports: 8080
              image: ${{ steps.meta.outputs.tags }}

๐Ÿ“– References

๐Ÿ’ฌ Contact