๐Ÿš€ GitHub Actions๋ฅผ ์ด์šฉํ•œ ๋ธ”๋กœ๊ทธ ์ž๋™ ๋ฐฐํฌ ๋ฌธ์ œ ํ•ด๊ฒฐ ๊ณผ์ •

@leekh8 ยท April 01, 2024 ยท 13 min read

Code N Solve ๐Ÿ“˜

GitHub Actions1๋ฅผ ์ด์šฉํ•œ ๋ฌธ์ œ ํ•ด๊ฒฐ๊ณผ ๋ฐฐํฌ ์ž๋™ํ™” ๐Ÿš€

GitHub Actions๋Š” ๊ฐœ๋ฐœ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ž๋™ํ™”ํ•˜์—ฌ ๋นŒ๋“œ, ํ…Œ์ŠคํŠธ, ๋ฐฐํฌ ๋“ฑ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ•๋ ฅํ•œ ๋„๊ตฌ์ด๋‹ค. ํ•˜์ง€๋งŒ ์˜ฌ๋ฐ”๋ฅธ ์„ค์ • ์—†์ด๋Š” ์›ํ•˜๋Š” ๋Œ€๋กœ ์ž‘๋™ํ•˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ๋‹ค. Deployment ์ž๋™ํ™”๋ฅผ ์œ„ํ•ด GitHub Actions์˜ Workflow๋ฅผ ์„ค์ •ํ•  ๋•Œ ๊ฒช์€ ๋ช‡ ๊ฐ€์ง€ ๋ฌธ์ œ์™€ ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์ด์•ผ๊ธฐํ•ด๋ณด์ž.

Blog Deployment ์ž๋™ํ™”

ํ˜„์žฌ ๋ธ”๋กœ๊ทธ ํ…Œ๋งˆ๋Š” gatsby-starter-hoodie๋ฅผ ํ™œ์šฉํ•˜๊ณ  ์žˆ๋‹ค.

์—ฌ๊ธฐ์— CI (Continuous Integration)2 ์ฝ”๋“œ๋Š” ์ด๋ฏธ ์ž‘์„ฑ๋˜์–ด ์žˆ๊ณ , Netlify๋ฅผ ํ†ตํ•œ ๋ฐฐํฌ ๋ฐฉ์‹์ด ์„ค๋ช…๋˜์–ด ์žˆ์ง€๋งŒ Github Pages๋ฅผ ์ด์šฉํ•ด ๋ฐฐํฌ๋ฅผ ํ•˜๊ณ  ์žˆ์—ˆ๋‹ค. ๋งค๋ฒˆ $ npm run deploy-gh ๋ช…๋ น์„ ํ•˜๊ธฐ ๊ท€์ฐฎ์•„์ ธ ์ž๋™ํ™” Workflow๋ฅผ ๋งŒ๋“ค๊ธฐ๋กœ ๊ฒฐ์‹ฌํ•œ๋‹ค.

GitHub Actions Workflow ์„ค์ •

1. GitHub Pages ์ž๋™ ๋ฐฐํฌ34

  • ์‹œ๋„:

    • GitHub Pages์— ์ž๋™์œผ๋กœ ๋ฐฐํฌํ•˜๊ธฐ.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ
      ```yaml
      name: Build and Deploy
      
      on:
        push:
          branches:
            - main
      
      jobs:
        deploy:
          runs-on: ubuntu-latest
      
          steps:
            - name: Checkout Repository
              uses: actions/checkout@v2
      
            - name: Setup Node.js
              uses: actions/setup-node@v2
              with:
                node-version: "14"
      
            - name: Install Dependencies
              run: npm install
      
            - name: Build
              run: npm run build
      
            - name: Deploy to GitHub Pages
              uses: peaceiris/actions-gh-pages@v3
              with:
                deploy_key: ${{ secrets.ACCESS_TOKEN }}
                publish_dir: ./public
                publish_branch: gh-pages
      ```
  • ๋ฌธ์ œ:

  • Workflow ์„ค์ • ํŒŒ์ผ(deploy.yml)์„ ์ž‘์„ฑํ–ˆ์ง€๋งŒ Node.js ๋ฒ„์ „์ด ๋‚ฎ์•„ Gatsby ๋นŒ๋“œ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

    ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ
    ```bash
    error Gatsby requires Node.js 18.0.0 or higher (you have v14.21.3).
    Upgrade Node to the latest stable release: https://gatsby.dev/upgrading-node-js
    npm ERR! code ELIFECYCLE
    ```

2. Node.js ๋ฒ„์ „ ์ถฉ๋Œ

  • ๋ฌธ์ œ:

    • Workflow ์„ค์ •์—์„œ๋Š” 14.21.3 ๋ฒ„์ „์ด ์ง€์ •๋˜์–ด ์žˆ์—ˆ๋Š”๋ฐ Node.js์˜ ๋ฒ„์ „ 18.0.0 ์ด์ƒ์„ ๋นŒ์š”๋กœ ํ•˜์—ฌ Gatsby ๋นŒ๋“œ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.
  • ์‹œ๋„:

    • Node.js ๋ฒ„์ „(node-version)์„ 20.3.1๋กœ ์—…๋ฐ์ดํŠธํ•˜์˜€๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
          on:
          push:
          branches: - main
      
          jobs:
          deploy:
          runs-on: ubuntu-latest
      
                steps:
                  - name: Checkout Repository
                    uses: actions/checkout@v2
      
                  - name: Setup Node.js
                    uses: actions/setup-node@v2
                    with:
                      node-version: 20.3.1
      
                  - name: Install Dependencies
                    run: npm install
      
                  - name: Build
                    run: npm run build
      
                  - name: Deploy to GitHub Pages
                    uses: peaceiris/actions-gh-pages@v3
                    with:
                      deploy_key: ${{ secrets.ACCESS_TOKEN }}
                      publish_dir: ./public
                      publish_branch: gh-pages
          ```
  • ํ•ด๊ฒฐ:

    • Node.js ๋ฒ„์ „์„ 20.3.1๋กœ ์—…๋ฐ์ดํŠธํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์ง€๋งŒ ์ดํ›„์— ํŒจํ‚ค์ง€ ์˜์กด์„ฑ ์ถฉ๋Œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.
      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```bash Run npm install npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: gatsby-remark-katex@3.10.0 npm ERR! Found: gatsby@5.13.3 npm ERR! node_modules/gatsby npm ERR! gatsby@"^5.11.0" from the root project npm ERR! peer gatsby@"^5.0.0-next" from babel-plugin-remove-graphql-queries@5.13.1 npm ERR! node_modules/babel-plugin-remove-graphql-queries npm ERR! babel-plugin-remove-graphql-queries@"^5.13.1" from gatsby@5.13.3 npm ERR! babel-plugin-remove-graphql-queries@"^5.13.1" from gatsby-plugin-typescript@5.13.1 npm ERR! node_modules/gatsby-plugin-typescript npm ERR! gatsby-plugin-typescript@"^5.13.1" from gatsby@5.13.3 npm ERR! 17 more (gatsby-plugin-catch-links, gatsby-plugin-feed, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer gatsby@"^2.0.0" from gatsby-remark-katex@3.10.0 npm ERR! node_modules/gatsby-remark-katex npm ERR! gatsby-remark-katex@"^3.5.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: gatsby@2.32.13 npm ERR! node_modules/gatsby npm ERR! peer gatsby@"^2.0.0" from gatsby-remark-katex@3.10.0 npm ERR! node_modules/gatsby-remark-katex npm ERR! gatsby-remark-katex@"^3.5.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. ```

3. Node.js ํŒจํ‚ค์ง€ ์˜์กด์„ฑ ์ถฉ๋Œ ๋ฐ GitHub ํ† ํฐ ์‹œํฌ๋ฆฟ ๋“ฑ๋ก

  • ์‹œ๋„:

    • ํŒจํ‚ค์ง€ ์˜์กด์„ฑ ์ถฉ๋Œ ๋ฌธ์ œ๋ฅผ --legacy-peer-deps ๋ช…๋ น์œผ๋กœ ํ•ด๊ฒฐํ•˜๊ณ  GitHub ํ† ํฐ์„ ์‹œํฌ๋ฆฟ์— ๋“ฑ๋ก์„ ํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
      push:
      branches: - main
      
      jobs:
      deploy:
      runs-on: ubuntu-latest
      
          steps:
            - name: Checkout Repository
              uses: actions/checkout@v2
      
            - name: Setup Node.js
              uses: actions/setup-node@v2
              with:
                node-version: 20.3.1
      
            - name: Install Dependencies
              run: npm install --legacy-peer-deps
      
            - name: Build
              run: npm run build
      
            - name: Deploy to GitHub Pages
              uses: peaceiris/actions-gh-pages@v3
              with:
                deploy_key: ${{ secrets.ACCESS_TOKEN }}
                publish_dir: ./public
                publish_branch: gh-pages
      
      ```
  • ํ•ด๊ฒฐ:

    • ํ”„๋กœํ•„ - Settings - Developer Settings - Personal access tokens์—์„œ ์ƒ์„ฑํ•œ ํ† ํฐ์„ ๋ณต์‚ฌํ•˜์—ฌ ์ €์žฅ์†Œ secrets์— ๋“ฑ๋กํ–ˆ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```bash Run peaceiris/actions-gh-pages@v3 with: deploy_key: *** publish_dir: ./public publish_branch: gh-pages allow_empty_commit: false keep_files: false force_orphan: false enable_jekyll: false disable_nojekyll: false exclude_assets: .github [INFO] Usage https://github.com/peaceiris/actions-gh-pages#readme Dump inputs [INFO] DeployKey: true [INFO] PublishBranch: gh-pages [INFO] PublishDir: ./public [INFO] DestinationDir: [INFO] ExternalRepository: [INFO] AllowEmptyCommit: false [INFO] KeepFiles: false [INFO] ForceOrphan: false [INFO] UserName: [INFO] UserEmail: [INFO] CommitMessage: [INFO] FullCommitMessage: [INFO] TagName: [INFO] TagMessage: [INFO] EnableJekyll (DisableNoJekyll): false [INFO] CNAME: [INFO] ExcludeAssets .github
      Setup auth token
      [INFO] setup SSH deploy key
      /usr/bin/chmod 700 /home/runner/.ssh
      [INFO] wrote /home/runner/.ssh/known_hosts
      /usr/bin/chmod 600 /home/runner/.ssh/known_hosts
      [INFO] wrote /home/runner/.ssh/github
      /usr/bin/chmod 600 /home/runner/.ssh/github
      [INFO] wrote /home/runner/.ssh/config
      /usr/bin/chmod 600 /home/runner/.ssh/config
      /usr/bin/ssh-add /home/runner/.ssh/github
      Error loading key "/home/runner/.ssh/github": error in libcrypto
      Error: Action failed with "The process '/usr/bin/ssh-add' failed with exit code 1"
      
      ````

4. User authenticate using git config

  • ์‹œ๋„:

    • token์„ secret์— ๋“ฑ๋กํ•˜์˜€์ง€๋งŒ token ์ธ์ฆ์— ์‹คํŒจํ•˜์—ฌ git config ๋ช…๋ น์„ ํ†ตํ•ด ์‚ฌ์šฉ์ž๋ฅผ ๋“ฑ๋กํ•˜์˜€๋‹ค.
  • ๋ฌธ์ œ:

    • SSH ์ธ์ฆ์€ Windows ํ™˜๊ฒฝ์—์„œ๋Š” ์ ์šฉ๋˜์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
        push:
          branches:
            - main
      
      jobs:
        deploy:
          runs-on: ubuntu-latest
      
          steps:
            - name: Checkout Repository
              uses: actions/checkout@v2
      
            - name: Setup Node.js
              uses: actions/setup-node@v2
              with:
                node-version: 20.3.1
      
            - name: Install Dependencies
              run: npm install --legacy-peer-deps
      
            - name: Build
              run: npm run build
      
            - name: Deploy to GitHub Pages
              env:
                ACCESS_TOKEN: ${{ secrets.PAT }}
              run: |
                git config --global user.name "USER NAME"
                git config --global user.email "USER@EMAIL.COM"
                npx gh-pages -d ./public -b gh-pages -u $ACCESS_TOKEN
      ```
      
      </details>
      - ๋ฌธ์ œ
        - git config ๋ช…๋ น์„ ํ†ตํ•ด ์‚ฌ์šฉ์ž๋ฅผ ๋“ฑ๋กํ–ˆ์ง€๋งŒ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.
        <details>
        <summary>์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ</summary>
      ```bash
      Run git config --global user.name "USER NAME"
        git config --global user.name "USER NAME"
        git config --global user.email "USER@EMAIL.COM"
        npx gh-pages -d ./public -b gh-pages -u $ACCESS_TOKEN
        shell: /usr/bin/bash -e {0}
        env:
          ACCESS_TOKEN: ***
      Could not parse name and email from user option "***" (format should be "Your Name <email@example.com>")
      Error: Process completed with exit code 1.
      ```

5. User authenticate using token

  • ์‹œ๋„:

    • token์œผ๋กœ ์‚ฌ์šฉ์ž ์ธ์ฆ์„ ์‹œ๋„ํ•˜์˜€๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
      push:
      branches: - main
      
      jobs:
      deploy:
      runs-on: ubuntu-latest
      
        steps:
          - name: Checkout Repository
            uses: actions/checkout@v2
      
          - name: Setup Node.js
            uses: actions/setup-node@v2
            with:
              node-version: 20.3.1
      
          - name: Install Dependencies
            run: npm install --legacy-peer-deps
      
          - name: Build
            run: npm run build
      
          - name: Deploy to GitHub Pages
            env:
              ACCESS_TOKEN: ${{ secrets.PAT }}
            run: |
              npx gh-pages -d ./public -b gh-pages -u $ACCESS_TOKEN
      
      ```
  • ๋ฌธ์ œ:

    • ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ๋ฐ˜๋ณต๋˜์—ˆ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```bash Run npx gh-pages -d ./public -b gh-pages -u $ACCESS_TOKEN npx gh-pages -d ./public -b gh-pages -u $ACCESS_TOKEN shell: /usr/bin/bash -e {0} env: ACCESS_TOKEN: *** Could not parse name and email from user option "***" (format should be "Your Name ") Error: Process completed with exit code 1. ```

6. User authenticate using token 2

  • ์‹œ๋„:

    • ํ† ํฐ์„ ์ด์šฉํ•ด ์‚ฌ์šฉ์ž ์ธ์ฆ์„ ์‹œ๋„ํ• ๋•Œ ์˜ต์…˜์„ -u์—์„œ -t๋กœ ๋ณ€๊ฒฝํ•ด ํ† ํฐ์„ ์ธ์‹ํ•˜๋„๋ก ํ•ด์ฃผ์—ˆ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
      push:
      branches: - main
      
      jobs:
      deploy:
      runs-on: ubuntu-latest
      
        steps:
          - name: Checkout Repository
            uses: actions/checkout@v2
      
          - name: Setup Node.js
            uses: actions/setup-node@v2
            with:
              node-version: 20.3.1
      
          - name: Install Dependencies
            run: npm install --legacy-peer-deps
      
          - name: Build
            run: npm run build
      
          - name: Deploy to GitHub Pages
            env:
              ACCESS_TOKEN: ${{ secrets.PAT }}
            run: |
              npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN
      ```
  • ๋ฌธ์ œ:

  • git config ๋ช…๋ น์„ ์ด์šฉํ•ด ์‚ฌ์šฉ์ž์˜ ์‹ ์›์„ ์„ค์ •ํ•˜๋ผ๋Š” ์˜ค๋ฅ˜(Author identity unknown)๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ๋‹ค.

    ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```bash Run npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN shell: /usr/bin/bash -e {0} env: ACCESS_TOKEN: *** Author identity unknown
    *** Please tell me who you are.
    
    Run
    
      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"
    
    to set your account's default identity.
    Omit --global to set the identity only in this repository.
    
    fatal: unable to auto-detect email address (got 'runner@fv-az1535-535.(none)')
    
    Error: Process completed with exit code 1.
    ```

7. User authenticate using git config 2

  • ์‹œ๋„:

    • git config ๋ช…๋ น์„ ์‚ฌ์šฉํ•ด ์‚ฌ์šฉ์ž ์ •๋ณด๋ฅผ ์ธ์‹ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ์—ˆ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
      push:
      branches: - main
      
      jobs:
      deploy:
      runs-on: ubuntu-latest
      
        steps:
          - name: Checkout Repository
            uses: actions/checkout@v2
      
          - name: Setup Node.js
            uses: actions/setup-node@v2
            with:
              node-version: 20.3.1
      
          - name: Install Dependencies
            run: npm install --legacy-peer-deps
      
          - name: Build
            run: npm run build
      
          - name: Deploy to GitHub Pages
            env:
              ACCESS_TOKEN: ${{ secrets.PAT }}
            run: |
              git config --global user.email "USER@EMAIL.COM"
              git config --global user.name "USER NAME"
              npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN
      
      ```
  • ๋ฌธ์ œ:

    • Author identity unknown ์˜ค๋ฅ˜๋Š” ๋ฐฐํฌ ์‹œ Git ์‚ฌ์šฉ์ž ์ •๋ณด๋ฅผ ์„ค์ •ํ•ด๋‘์ง€ ์•Š์•„ ๋ฐœ์ƒํ•˜๋Š” ์˜ค๋ฅ˜๋กœ Git์ด ์ปค๋ฐ‹์„ ์ƒ์„ฑํ•  ๋•Œ ์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋ฅผ ํ•„์š”๋กœ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐœ์ƒํ•˜๋Š”๋ฐ ๋ฌธ์ œ๊ฐ€ ๋ฐ˜๋ณต๋˜์—ˆ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```bash Run git config --global user.email "USER@EMAIL.COM" git config --global user.email "USER@EMAIL.COM" git config --global user.name "USER NAME" npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN shell: /usr/bin/bash -e {0} env: ACCESS_TOKEN: *** fatal: could not read Username for 'https://github.com': No such device or address
      Error: Process completed with exit code 1.
      
      ```

8. User authenticate using git config 3

  • ์‹œ๋„:

    • HTTPS URL์— ํ† ํฐ์„ ์ถ”๊ฐ€ํ•˜์—ฌ ์‚ฌ์šฉ์ž๋ฅผ ์ธ์‹ํ•  ์ˆ˜ ์žˆ๊ฒŒ ์‹œ๋„ํ•˜์˜€๋‹ค.5

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
        on:
          push:
            branches:
              - main
      
        jobs:
          deploy:
            runs-on: ubuntu-latest
      
            steps:
              - name: Checkout Repository
                uses: actions/checkout@v2
      
              - name: Setup Node.js
                uses: actions/setup-node@v2
                with:
                  node-version: 20.3.1
      
              - name: Install Dependencies
                run: npm install --legacy-peer-deps
      
              - name: Build
                run: npm run build
      
              - name: Deploy to GitHub Pages
                env:
                  ACCESS_TOKEN: ${{ secrets.PAT }}
                run: |
                  git config --global url.https://${{ secrets.PAT }}@github.com/.insteadOf https://github.com/
                  npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN
      
      ```
  • ๋ฌธ์ œ:

    • ์—ฌ์ „ํžˆ Author identity unknown ์ƒํƒœ์ด๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```bash Run git config --global url.https://***@github.com/.insteadOf https://github.com/ git config --global url.https://***@github.com/.insteadOf https://github.com/ npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN shell: /usr/bin/bash -e {0} env: ACCESS_TOKEN: *** Author identity unknown
      \*\*\* Please tell me who you are.
      
      Run
      
      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"
      
      to set your account's default identity.
      Omit --global to set the identity only in this repository.
      
      fatal: empty ident name (for <runner@fv-az1118-461.jboa14ee0bjuvjv5ua334yvpdd.cx.internal.cloudapp.net>) not allowed
      
      Error: Process completed with exit code 1.
      
      ```

9. User authenticate using git config 4

  • ์‹œ๋„:

    • ๋‹ค์‹œ git config ๋ช…๋ น์„ ์‚ฌ์šฉํ•ด ์‚ฌ์šฉ์ž ์ •๋ณด๋ฅผ ์ถ”๊ฐ€ํ•˜์˜€๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
        push:
          branches:
            - main
      
      jobs:
        deploy:
          runs-on: ubuntu-latest
      
          steps:
            - name: Checkout Repository
              uses: actions/checkout@v2
      
            - name: Setup Node.js
              uses: actions/setup-node@v2
              with:
                node-version: 20.3.1
      
            - name: Install Dependencies
              run: npm install --legacy-peer-deps
      
            - name: Build
              run: npm run build
      
            - name: Deploy to GitHub Pages
              env:
                ACCESS_TOKEN: ${{ secrets.PAT }}
              run: |
                git config --global user.name "USER NAME"
                git config --global user.email "USER@EMAIL.COM"
                npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN
      ```
      
      </details>
      
      - ๋ฌธ์ œ:
        - ์ด์ „์— ๋‚˜ํƒ€๋‚ฌ๋˜ ๋ฌธ์ œ๊ฐ€ ๊ณ„์† ๋‚˜ํƒ€๋‚˜ ๋ˆˆ๋ฌผ์ด ๋‚  ๋ป” ํ–ˆ๋‹ค.
      
        <details>
        <summary>์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ</summary>
          ```bash
          Run git config --global user.name "USER NAME"
            git config --global user.name "USER NAME"
            git config --global user.email "USER@EMAIL.COM"
            npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN
            shell: /usr/bin/bash -e {0}
            env:
              ACCESS_TOKEN: ***
          fatal: could not read Username for 'https://github.com': No such device or address
          ```

10. User authenticate using git config 5

  • ์‹œ๋„:

    • ํ˜น์‹œ ํ† ํฐ์ด ์ธ์‹์ด ์•ˆ๋˜๊ณ  ์žˆ๋‚˜ ์˜์‹ฌ์Šค๋Ÿฌ์›Œ์„œ ์ˆœ์„œ๋ฅผ ๋ณ€๊ฒฝํ•˜์—ฌ ๋‹ค์‹œ ์‹œ๋„ํ•˜์˜€๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
      push:
      branches: - main
      
      jobs:
      deploy:
      runs-on: ubuntu-latest
      env:
      PAT: ${{ secrets.PAT }}
      
        steps:
          - name: Checkout Repository
            uses: actions/checkout@v2
      
          - name: Setup Node.js
            uses: actions/setup-node@v2
            with:
              node-version: 20.3.1
      
          - name: Install Dependencies
            run: npm install --legacy-peer-deps
      
          - name: Build
            run: npm run build
      
          - name: Deploy to GitHub Pages
            run: |
              git config --global url.https://$PAT@github.com/.insteadOf https://github.com/
              npx gh-pages -d ./public -b gh-pages -t $PAT
      
      ```
  • ๋ฌธ์ œ:

    • ๋‹ฌ๋ผ์ง€์ง€ ์•Š์€ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๊ฐ€ ๋‚˜์™€ ๋ˆˆ๋ฌผ์ด ๋‚ฌ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```bash Run git config --global user.name "USER NAME" git config --global user.name "USER NAME" git config --global user.email "USER@EMAIL.COM" npx gh-pages -d ./public -b gh-pages -t $ACCESS_TOKEN shell: /usr/bin/bash -e {0} env: ACCESS_TOKEN: *** fatal: could not read Username for 'https://github.com': No such device or address
      Error: Process completed with exit code 1.
      ```

11. User authenticate using git config 6

  • ์‹œ๋„:

    • git config ๋ช…๋ น์„ ๋นŒ๋“œ ๊ณผ์ •์—์„œ ๋ฏธ๋ฆฌ ํ•ด์ฃผ๋ฉด ๋ ๊นŒ ์‹ถ์–ด ์‹œ๋„ํ•˜์˜€๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
      push:
      branches: - main
      
      jobs:
      deploy:
      runs-on: ubuntu-latest
      env:
      PAT: ${{ secrets.PAT }}
      
          steps:
            - name: Checkout Repository
              uses: actions/checkout@v2
      
            - name: Setup Node.js
              uses: actions/setup-node@v2
              with:
                node-version: 20.3.1
      
            - name: Install Dependencies
              run: npm install --legacy-peer-deps
      
            - name: Build
              run: |
                git config --global url.https://$PAT@github.com/.insteadOf https://github.com/
                npm run build
      
            - name: Deploy to GitHub Pages
              run: |
                npx gh-pages -d ./public -b gh-pages -t $PAT
      
      ```
  • ํ•ด๊ฒฐ:

    • git config ๋ช…๋ น์„ deploy ๊ณผ์ • ์ด์ „์— ์ง„ํ–‰ํ•ด์•ผ ํ•œ๋‹ค๋Š” ๊ฒฐ๋ก ์„ ์–ป์—ˆ๋‹ค.
  • ๋ฌธ์ œ:

    • ์—ฌ์ „ํžˆ Author identity unknow ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```bash Run npx gh-pages -d ./public -b gh-pages -t $PAT npx gh-pages -d ./public -b gh-pages -t $PAT shell: /usr/bin/bash -e {0} env: PAT: *** Author identity unknown
      \*\*\* Please tell me who you are.
      
      Run
      
      git config --global user.email "you@example.com"
      git config --global user.name "Your Name"
      
      to set your account's default identity.
      Omit --global to set the identity only in this repository.
      
      fatal: unable to auto-detect email address (got 'runner@fv-az1385-401.(none)')
      
      Error: Process completed with exit code 1.
      
      ```

12. User authenticate using git config 7

  • ์‹œ๋„:

    • git config ๋ช…๋ น์„ ํ†ตํ•œ ์‚ฌ์šฉ์ž ์ •๋ณด ์„ค์ • ๋‹จ๊ณ„๋ฅผ ๋ณ„๋„๋กœ ๋งŒ๋“ค์–ด ์ฃผ์—ˆ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
      push:
      branches: - main
      
      jobs:
      deploy:
      runs-on: ubuntu-latest
      env:
      PAT: ${{ secrets.PAT }}
      
        steps:
          - name: Checkout Repository
            uses: actions/checkout@v2
      
          - name: Setup Node.js
            uses: actions/setup-node@v2
            with:
              node-version: 20.3.1
      
          - name: Install Dependencies
            run: npm install --legacy-peer-deps
      
          - name: Build
            run: npm run build
      
          - name: Set Git user information
            run: git config --global url.https://$PAT@github.com/.insteadOf https://github.com/
      
          - name: Deploy to GitHub Pages
            run: |
              npx gh-pages -d ./public -b gh-pages -t $PAT
      
      ```
  • ๋ฌธ์ œ:

    • ๋‹ค์‹œ ๋ˆˆ๋ฌผ์ด ๋‚ฌ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```bash Run npx gh-pages -d ./public -b gh-pages -t $PAT npx gh-pages -d ./public -b gh-pages -t $PAT shell: /usr/bin/bash -e {0} env: PAT: *** Author identity unknown
        \*\*\* Please tell me who you are.
      
        Run
      
        git config --global user.email "you@example.com"
        git config --global user.name "Your Name"
      
        to set your account's default identity.
        Omit --global to set the identity only in this repository.
      
        fatal: empty ident name (for <runner@fv-az914-157.2e4pmxhwlzfuhnev11cd0y0noa.phxx.internal.cloudapp.net>) not allowed
      
        Error: Process completed with exit code 1.
      
      ```

13. User authenticate using git config 8

  • ์‹œ๋„:

    • ์‚ฌ์šฉ์ž ์ •๋ณด ๋‹จ๊ณ„์—์„œ ๊ฐ€์ง„ ๋ชจ๋“  ์ •๋ณด๋ฅผ ์•Œ๋ ค์ฃผ์—ˆ๋‹ค.

      ์ ‘๊ธฐ/ํŽผ์น˜๊ธฐ ```yaml name: Build and Deploy
      on:
      push:
      branches: - main
      
      jobs:
      deploy:
      runs-on: ubuntu-latest
      env:
      PAT: ${{ secrets.PAT }}
      
        steps:
          - name: Checkout Repository
            uses: actions/checkout@v2
      
          - name: Setup Node.js
            uses: actions/setup-node@v2
            with:
              node-version: 20.3.1
      
          - name: Install Dependencies
            run: npm install --legacy-peer-deps
      
          - name: Build
            run: npm run build
      
          - name: Set Git user information
            run: |
              git config --global user.email "amysun125@gmail.com"
              git config --global user.name "leekh8"
      
          - name: Deploy to GitHub Pages
            run: |
              git config --global url.https://$PAT@github.com/.insteadOf https://github.com/
              npx gh-pages -d ./public -b gh-pages -t $PAT
      
      ```
  • ์„ฑ๊ณต!
  Published
@leekh8
Hello :)