{"meta":{"title":"Azure Static Web App에 배포","intro":"지속적인 배포(CD) 워크플로의 일부로 웹앱을 Azure 정적 웹앱에 배포하는 방법을 알아봅니다.","product":"GitHub Actions","breadcrumbs":[{"href":"/ko/actions","title":"GitHub Actions"},{"href":"/ko/actions/how-tos","title":"사용법"},{"href":"/ko/actions/how-tos/deploy","title":"배포"},{"href":"/ko/actions/how-tos/deploy/deploy-to-third-party-platforms","title":"타사 플랫폼에 배포"},{"href":"/ko/actions/how-tos/deploy/deploy-to-third-party-platforms/azure-static-web-app","title":"정적 웹앱 Azure"}],"documentType":"article"},"body":"# Azure Static Web App에 배포\n\n지속적인 배포(CD) 워크플로의 일부로 웹앱을 Azure 정적 웹앱에 배포하는 방법을 알아봅니다.\n\n## 필수 조건\n\nGitHub Actions 워크플로를 만들기 전에 먼저 다음 설정 단계를 완료해야 합니다.\n\n1. 배포 원본에 대한 '기타' 옵션을 사용하여 Azure Static Web App을 만듭니다. 자세한 내용은 [Quickstart: Azure 설명서의 Azure Portal](https://docs.microsoft.com/azure/static-web-apps/get-started-portal)에서 첫 번째 정적 사이트 빌드를 참조하세요.\n\n1. 정적 웹앱 배포 토큰 값으로 `AZURE_STATIC_WEB_APPS_API_TOKEN`이라는 비밀을 만듭니다. 배포 토큰을 찾는 방법을 알아보려면 Azure 설명서의 [Azure Static Web Apps에서 배포 토큰 재설정](https://docs.microsoft.com/azure/static-web-apps/deployment-token-management)을 참조하세요.\n\n## 워크플로 만들기\n\n필수 구성 요소를 완료한 후에는 워크플로 만들기를 진행할 수 있습니다.\n\n다음 예제 워크플로에서는 `main` 분기에 푸시가 있거나 `main` 대상으로 하는 끌어오기 요청이 열리거나 동기화되거나 다시 열릴 때 Azure 정적 웹앱을 빌드하고 배포하는 방법을 보여 줍니다. 또한 워크플로는 `main`을 대상으로 하는 끌어오기 요청이 닫힐 때 해당하는 사전 프로덕션 배포를 해제합니다.\n\n워크플로 `env` 키에서 다음 값을 바꿉니다.\n* `APP_LOCATION`을 클라이언트 코드의 위치로 바꿉니다.\n* `API_LOCATION`을 API 원본 코드의 위치로 바꿉니다. \n`API_LOCATION`이 관련이 없으면 변수와 변수가 사용되는 행을 삭제할 수 있습니다.\n* `OUTPUT_LOCATION`을 클라이언트 코드 빌드 출력의 위치로 바꿉니다.\n\n이러한 값에 대한 자세한 내용은 Azure 설명서의 [Azure Static Web Apps](https://docs.microsoft.com/azure/static-web-apps/build-configuration?tabs=github-actions)에 대한 빌드 구성을 참조하세요.\n\n```yaml copy\n# 이 워크플로는 GitHub에서 인증되지 않은 작업을 사용합니다.\n# 작업은 타사에서 제공하며\n# 별도의 서비스 약관, 개인정보처리방침, 지원 설명서에서 규정됩니다.\n# 참조하세요.\n\n# 커밋 SHA에 작업을 고정하는 것이 좋습니다.\n# 최신 버전을 얻으려면 SHA를 업데이트해야 합니다.\n# 태그 또는 분기를 참조할 수도 있지만 경고 없이 작업이 변경될 수 있습니다.\n\nname: Deploy web app to Azure Static Web Apps\n\nenv:\n  APP_LOCATION: \"/\" # location of your client code\n  API_LOCATION: \"api\" # location of your api source code - optional\n  OUTPUT_LOCATION: \"build\" # location of client code build output\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    types: [opened, synchronize, reopened, closed]\n    branches:\n      - main\n\npermissions:\n  issues: write\n  contents: read\n  pull-requests: write\n\njobs:\n  build_and_deploy:\n    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')\n    runs-on: ubuntu-latest\n    name: Build and Deploy\n    steps:\n      - uses: actions/checkout@v6\n        with:\n          submodules: true\n      - name: Build And Deploy\n        uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9\n        with:\n          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}\n          repo_token: ${{ secrets.GITHUB_TOKEN }}\n          action: \"upload\"\n          app_location: ${{ env.APP_LOCATION }}\n          api_location: ${{ env.API_LOCATION }}\n          output_location: ${{ env.OUTPUT_LOCATION }}\n\n  close_pull_request:\n    if: github.event_name == 'pull_request' && github.event.action == 'closed'\n    runs-on: ubuntu-latest\n    name: Close Pull Request\n    steps:\n      - name: Close Pull Request\n        uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9\n        with:\n          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}\n          action: \"close\"\n```\n\n## 추가 참고 자료\n\n* 원래의 워크플로 템플릿은 [`azure-staticwebapp.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-staticwebapp.yml)을 GitHub Actions `starter-workflows` 리포지토리에서 참조하세요.\n* 웹앱을 배포하는 데 사용되는 작업은 공식 Azure [`Azure/static-web-apps-deploy`](https://github.com/Azure/static-web-apps-deploy) 작업입니다.\n* Azure 배포하는 GitHub 작업 워크플로에 대한 자세한 예제는 [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) 리포지토리를 참조하세요."}