Skip to main content

์ด ๋ฒ„์ „์˜ GitHub Enterprise Server๋Š” ๋‹ค์Œ ๋‚ ์งœ์— ์ค‘๋‹จ๋ฉ๋‹ˆ๋‹ค. 2025-08-27. ์ค‘์š”ํ•œ ๋ณด์•ˆ ๋ฌธ์ œ์— ๋Œ€ํ•ด์„œ๋„ ํŒจ์น˜ ๋ฆด๋ฆฌ์Šค๊ฐ€ ์ด๋ฃจ์–ด์ง€์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋” ๋›ฐ์–ด๋‚œ ์„ฑ๋Šฅ, ํ–ฅ์ƒ๋œ ๋ณด์•ˆ, ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์„ ์œ„ํ•ด ์ตœ์‹  ๋ฒ„์ „์˜ GitHub Enterprise Server๋กœ ์—…๊ทธ๋ ˆ์ด๋“œํ•ฉ๋‹ˆ๋‹ค. ์—…๊ทธ๋ ˆ์ด๋“œ์— ๋Œ€ํ•œ ๋„์›€๋ง์€ GitHub Enterprise ์ง€์›์— ๋ฌธ์˜ํ•˜์„ธ์š”.

Deploying PHP to Azure App Service

Learn how to deploy a PHP project to Azure App Service as part of your continuous deployment (CD) workflows.

์ด ๋ฌธ์„œ์˜ ๋‚ด์šฉ

Prerequisites

Before creating your GitHub Actions workflow, you will first need to complete the following setup steps:

  1. Azure App Service ์š”๊ธˆ์ œ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

    ์˜ˆ๋ฅผ ๋“ค์–ด Azure CLI๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ƒˆ App Service ์š”๊ธˆ์ œ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    Bash
    az appservice plan create \
       --resource-group MY_RESOURCE_GROUP \
       --name MY_APP_SERVICE_PLAN \
       --is-linux
    

    ์œ„์˜ ๋ช…๋ น์—์„œ MY_RESOURCE_GROUP์„ ๊ธฐ์กด Azure ๋ฆฌ์†Œ์Šค ๊ทธ๋ฃน์œผ๋กœ ๋ฐ”๊พธ๊ณ  MY_APP_SERVICE_PLAN์„ App Service ์š”๊ธˆ์ œ์˜ ์ƒˆ ์ด๋ฆ„์œผ๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค.

    Azure CLI ์‚ฌ์šฉ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ Azure ์„ค๋ช…์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

    • ์ธ์ฆ์€ Azure CLI๋กœ ๋กœ๊ทธ์ธ์„ ์ฐธ์กฐํ•˜์„ธ์š”.
    • ์ƒˆ ๋ฆฌ์†Œ์Šค ๊ทธ๋ฃน์„ ๋งŒ๋“ค์–ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ az group์„ ์ฐธ์กฐํ•˜์„ธ์š”.
  2. Create a web app.

    For example, you can use the Azure CLI to create an Azure App Service web app with a PHP runtime:

    Bash
    az webapp create \
        --name MY_WEBAPP_NAME \
        --plan MY_APP_SERVICE_PLAN \
        --resource-group MY_RESOURCE_GROUP \
        --runtime "php|7.4"
    

    In the command above, replace the parameters with your own values, where MY_WEBAPP_NAME is a new name for the web app.

  3. Azure ๊ฒŒ์‹œ ํ”„๋กœํ•„์„ ๊ตฌ์„ฑํ•˜๊ณ  AZURE_WEBAPP_PUBLISH_PROFILE ๋น„๋ฐ€์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

    ๊ฒŒ์‹œ ํ”„๋กœํ•„์„ ์‚ฌ์šฉํ•˜์—ฌ Azure ๋ฐฐํฌ ์ž๊ฒฉ ์ฆ๋ช…์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ Azure ์„ค๋ช…์„œ์˜ ๋ฐฐํฌ ์ž๊ฒฉ ์ฆ๋ช… ์ƒ์„ฑ์„ ์ฐธ์กฐํ•˜์„ธ์š”.

    GitHub ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์—์„œ ๊ฒŒ์‹œ ํ”„๋กœํ•„์˜ ์ฝ˜ํ…์ธ ๊ฐ€ ํฌํ•จ๋œ AZURE_WEBAPP_PUBLISH_PROFILE์ด๋ผ๋Š” ๋น„๋ฐ€์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. ๋น„๋ฐ€์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์˜ ์ž์„ธํ•œ ๋‚ด์šฉ์€ GitHub Actions์—์„œ ๋น„๋ฐ€ ์‚ฌ์šฉ์„(๋ฅผ) ์ฐธ์กฐํ•˜์„ธ์š”.

  4. Optionally, configure a deployment environment. ํ™˜๊ฒฝ์€ ์ผ๋ฐ˜์ ์ธ ๋ฐฐํฌ ๋Œ€์ƒ(์˜ˆ: production, staging ๋˜๋Š” development)์„ ์„ค๋ช…ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. GitHub Actions ์›Œํฌํ”Œ๋กœ๊ฐ€ ํ™˜๊ฒฝ์— ๋ฐฐํฌ๋˜๋ฉด ํ™˜๊ฒฝ์ด ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์˜ ๊ธฐ๋ณธ ํŽ˜์ด์ง€์— ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. ์ž‘์—…์„ ์ง„ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด ์Šน์ธ์„ ์š”๊ตฌํ•˜๊ฑฐ๋‚˜ ์›Œํฌํ”Œ๋กœ, ์‚ฌ์šฉ์ž ์ง€์ • ๋ฐฐํฌ ๋ณดํ˜ธ ๊ทœ์น™์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฒŒ์ดํŠธ ๋ฐฐํฌ๋ฅผ ํŠธ๋ฆฌ๊ฑฐํ•  ์ˆ˜ ์žˆ๋Š” ๋ถ„๊ธฐ๋ฅผ ์ œํ•œํ•˜๊ฑฐ๋‚˜ ๋น„๋ฐ€์— ๋Œ€ํ•œ ์•ก์„ธ์Šค๋ฅผ ์ œํ•œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ™˜๊ฒฝ์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ Managing environments for deployment์„(๋ฅผ) ์ฐธ์กฐํ•˜์„ธ์š”.

Creating the workflow

Once you've completed the prerequisites, you can proceed with creating the workflow.

The following example workflow demonstrates how to build and deploy a PHP project to Azure App Service when there is a push to the main branch.

Ensure that you set AZURE_WEBAPP_NAME in the workflow env key to the name of the web app you created. If the path to your project is not the repository root, change AZURE_WEBAPP_PACKAGE_PATH to the path to your project. If you use a version of PHP other than 8.x, changePHP_VERSION to the version that you use.

๋ฐฐํฌ ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•œ ๊ฒฝ์šฐ ํ™˜๊ฒฝ์˜ ์ด๋ฆ„์œผ๋กœ environment ๊ฐ’์„ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค. ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ environment ํ‚ค๋ฅผ ์‚ญ์ œํ•ฉ๋‹ˆ๋‹ค.

YAML
# ์ด ์›Œํฌํ”Œ๋กœ๋Š” GitHub์—์„œ ์ธ์ฆ๋˜์ง€ ์•Š์€ ์ž‘์—…์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
# ์ž‘์—…์€ ํƒ€์‚ฌ์—์„œ ์ œ๊ณตํ•˜๋ฉฐ
# ๋ณ„๋„์˜ ์„œ๋น„์Šค ์•ฝ๊ด€, ๊ฐœ์ธ์ •๋ณด์ฒ˜๋ฆฌ๋ฐฉ์นจ, ์ง€์› ์„ค๋ช…์„œ์—์„œ ๊ทœ์ •๋ฉ๋‹ˆ๋‹ค.
# ์ฐธ์กฐํ•˜์„ธ์š”.

# ์ปค๋ฐ‹ SHA์— ์ž‘์—…์„ ๊ณ ์ •ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.
# ์ตœ์‹  ๋ฒ„์ „์„ ์–ป์œผ๋ ค๋ฉด SHA๋ฅผ ์—…๋ฐ์ดํŠธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
# ํƒœ๊ทธ ๋˜๋Š” ๋ถ„๊ธฐ๋ฅผ ์ฐธ์กฐํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ ๊ฒฝ๊ณ  ์—†์ด ์ž‘์—…์ด ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

name: Build and deploy PHP app to Azure Web App

env:
  AZURE_WEBAPP_NAME: MY_WEBAPP_NAME   # set this to your application's name
  AZURE_WEBAPP_PACKAGE_PATH: '.'      # set this to the path to your web app project, defaults to the repository root
  PHP_VERSION: '8.x'                  # set this to the PHP version to use

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@1f2e3d4c5b6a7f8e9d0c1b2a3e4f5d6c7b8a9e0f
        with:
          php-version: ${{ env.PHP_VERSION }}

      - name: Check if composer.json exists
        id: check_files
        uses: andstor/file-existence-action@2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b
        with:
          files: 'composer.json'

      - name: Get Composer Cache Directory
        id: composer-cache
        if: steps.check_files.outputs.files_exists == 'true'
        run: |
          echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

      - name: Set up dependency caching for faster installs
        uses: actions/cache@v4
        if: steps.check_files.outputs.files_exists == 'true'
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: |
            ${{ runner.os }}-composer-

      - name: Run composer install if composer.json exists
        if: steps.check_files.outputs.files_exists == 'true'
        run: composer validate --no-check-publish && composer install --prefer-dist --no-progress

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v3
        with:
          name: php-app
          path: .

  deploy:
    runs-on: ubuntu-latest
    needs: build
    environment:
      name: 'production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v3
        with:
          name: php-app

      - name: 'Deploy to Azure Web App'
        id: deploy-to-webapp
        uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c
        with:
          app-name: ${{ env.AZURE_WEBAPP_NAME }}
          publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
          package: .

Further reading