Merge pull request #40 from SOFTLIMA/RYAN-DESCRICAO #16
This file contains 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: Build and Deploy Angular Project | |
on: | |
push: | |
branches: | |
- main # Ou a branch que você deseja monitorar para o deploy | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest # Ambiente de execução (Ubuntu) | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 # Faz o checkout do código | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.19.0' # Definindo a versão do Node.js para v18.19 ou superior | |
- name: Install dependencies | |
run: npm install # Instala as dependências do projeto | |
- name: Build Angular project | |
run: npm run build --if-present # Executa o build do Angular | |
- name: Test FTP Connection (Debug) | |
run: | | |
echo "Testing FTP Connection..." | |
echo "FTP connection test" > test.txt # Cria o arquivo de teste | |
curl --ftp-create-dirs -u ${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }} "ftp://${{ secrets.FTP_HOST }}/test.txt" -T test.txt || echo "FTP connection failed" | |
rm test.txt # Remove o arquivo de teste após a verificação | |
- name: FTP Deploy Locaweb | |
uses: locaweb/[email protected] | |
with: | |
host: ${{ secrets.FTP_HOST }} # Usando a variável de ambiente do FTP_HOST | |
user: ${{ secrets.FTP_USERNAME }} # Usando a variável de ambiente do FTP_USERNAME | |
password: ${{ secrets.FTP_PASSWORD }} # Usando a variável de ambiente do FTP_PASSWORD | |
localDir: "docs/browser" # Ajustado para o localDir correto |