I have written a yaml script with a help of a blog that contains all the necessary work that needs to be carried out in order to deploy my application to an ec2 instance running ubuntu. NGINX has been installed and is running.
Unfortunately, my yaml script fails silently, I do not know what is wrong, here is the code that’s in the script
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
# using Ubuntu
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install
- name: Install Angular CLI
uses: borales/actions-yarn@v4
with:
cmd: yarn global add @angular/cli
- name: Build production bundle
uses: borales/actions-yarn@v4
with:
cmd: build:prod # will run `yarn build:prod` command
- name: Deploy to my EC2 instance
uses: easingthems/ssh/[email protected]
with:
SSH_PRIVATE_KEY: $ {{ secrets.SSH_PRIVATE_KEY }} # I have the SSH_Private key of the instance saved as secrets in GitHub under the repository settings.
SOURCE: "dist/my-client-app"
REMOTE_HOST: "my-remote-host" # here I used my instances's IP Address. Not sure if that is what I am supposed to put there.
REMOTE_USER: "ubuntu"
TARGET: "/var/www/html/my-client-app"
Can anyone point out what could be the issue here?
2
Answers
I just wanted to let you know that I ended up using Amplify, which was a lot easier. At the end non of the recommended answers worked. The linux ubuntu EC2 was still giving me issues. It escalated to ng build not found but the environment had everything set so yaa.
this is an example of workflow that build, test and deploy angular app to AWS S3: