Deploy to GitHub Pages #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to GitHub Pages | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| with: | |
| persist-credentials: false # 수동 인증 정보를 덮어쓰지 않도록 설정 | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "toothlessdev@users.noreply.github.com" | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build project | |
| run: npm run build | |
| - name: Checkout gh-pages branch | |
| run: | | |
| git fetch origin gh-pages | |
| git checkout gh-pages || git checkout -b gh-pages | |
| - name: Copy build files | |
| run: cp -r build/* . | |
| - name: Deploy to GitHub Pages | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/toothlessdev/toothlessdev.github.io.git | |
| git add . | |
| git commit -m "Deploy to GitHub Pages" | |
| git checkout gh-pages | |
| git push origin gh-pages |