Merge pull request #12 from mikevelko/feature/dependency-resolve #12
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 an angular project | |
on: | |
push: | |
branches: | |
- master | |
- pipeline | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Node 12.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "12.x" | |
- name: Install dependencies | |
run: npm i | |
- name: Instal angular | |
run: npm i -g @angular/cli | |
- name: Build | |
run: ng build --base-href ${{ secrets.BASE_HREF }} --configuration production | |
- name: Archive build | |
if: success() | |
uses: actions/upload-artifact@v1 | |
with: | |
name: dist | |
path: dist | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Instal angular | |
run: sudo npm i -g @angular/cli | |
- name: Install dependencies | |
run: npm i | |
- name: Build production | |
run: ng build --base-href ${{ secrets.BASE_HREF }} --configuration production | |
- name: Instal sshpass | |
run: | | |
sudo apt-get update | |
sudo apt-get install sshpass -y | |
- name: Delete previous version | |
run: sudo sshpass -v -p '${{ secrets.SSH_PASS }}' -v ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} 'rm -rf /var/www/admin.grbpwr.com/html/*' | |
- name: Deploy production | |
run: sshpass -v -p '${{ secrets.SSH_PASS }}' scp -v -o stricthostkeychecking=no -r ./dist/grb-admin/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/admin.grbpwr.com/html |