fix some problems #59
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: Angular Build and Deploy | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checking out code" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Node.js and Angular CLI | |
run: | | |
sudo apt update | |
sudo apt install -y nodejs npm | |
sudo npm install -g @angular/cli | |
- name: Build | |
if: github.ref == 'refs/heads/main' | |
run: | | |
npm i | |
ng build --configuration=production | |
- name: Build | |
if: github.ref != 'refs/heads/main' | |
run: | | |
npm i | |
ng build --configuration=development | |
- name: Set deploy dir | |
run: | | |
echo "DEPLOY_DIR=${{ github.ref == 'refs/heads/main' && './www' || './develop/www' }}" >> $GITHUB_ENV | |
- name: Upload via FTP | |
uses: airvzxf/ftp-deployment-action@latest | |
with: | |
server: ${{ secrets.CD_FTP_SERVER }} | |
user: ${{ secrets.CD_FTP_USERNAME }} | |
password: ${{ secrets.CD_FTP_PASSWORD }} | |
local_dir: "./dist/webovky" | |
remote_dir: ${{ env.DEPLOY_DIR }} | |
delete: "true" | |
- name: Clean up | |
run: | | |
rm -r ./dist | |