Update index.html #5
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 React to deploy branch | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repositório | |
| uses: actions/checkout@v3 | |
| - name: Instalar Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Instalar dependências | |
| run: npm install | |
| - name: Build do projeto | |
| run: npm run build | |
| - name: Deploy para branch deploy | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| # Pega apenas o conteúdo da dist | |
| git checkout --orphan deploy | |
| git --work-tree=dist add --all | |
| git --work-tree=dist commit -m "Deploy automático" | |
| # Força push para branch deploy | |
| git push origin HEAD:deploy --force |