Skip to content

Commit 0272411

Browse files
committed
update yml 2
1 parent ee42716 commit 0272411

1 file changed

Lines changed: 26 additions & 28 deletions

File tree

.github/workflows/main.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name: Test, Build, and Deploy | Modul 01 – Lab2.2 Senior Project
2-
2+
33
on:
44
push:
55
branches: [main]
6-
6+
77
jobs:
88
test-build:
99
runs-on: ubuntu-latest
10-
10+
1111
strategy:
1212
matrix:
1313
node-version: [16.x]
14-
14+
1515
steps:
1616
- uses: actions/checkout@v2
1717
- name: Testing Build pre-Deploy
@@ -21,15 +21,15 @@ jobs:
2121
cache: "npm"
2222
- run: npm i
2323
- run: npm run build
24-
24+
2525
deploy:
2626
needs: test-build
2727
runs-on: ubuntu-latest
28-
28+
2929
strategy:
3030
matrix:
3131
node-version: [16.x]
32-
32+
3333
steps:
3434
- name: Build app on VM
3535
uses: appleboy/ssh-action@master
@@ -39,24 +39,22 @@ jobs:
3939
password: ${{ secrets.PASSWORD }}
4040
port: ${{ secrets.PORT }}
4141
script: |
42-
eval "$(ssh-agent -s)"
43-
ssh-add ~/.ssh/ssh-praktikan94
44-
echo "Cek folder project";
45-
[ -d "C:/Users/Emir Abe Putra A/senpro-github-action" ] && {
46-
echo "Repository belum di-clone. Cloning...";
47-
mkdir -p ~/senpro/499337/modul02;
48-
cd ~/senpro/499337/modul02;
49-
git clone https://github.com/abeputra/senpro-github-action.git;
50-
cd ~/senpro/499337/modul02/senpro-github-action;
51-
echo "Install Package dan Build Project";
52-
npm install;
53-
npm run build;
54-
} || {
55-
echo "Repository sudah ada. Building...";
56-
cd ~/senpro/499337/modul02/senpro-github-action;
57-
git restore .;
58-
git pull origin main;
59-
echo "Install Package dan Build Project";
60-
npm install;
61-
npm run build;
62-
}
42+
eval "$(ssh-agent -s)"
43+
ssh-add ~/.ssh/ssh-praktikan94
44+
45+
echo "Cek folder project"
46+
if [ ! -d "$HOME/senpro/499337/modul02/senpro-github-action" ]; then
47+
echo "Repository belum di-clone. Cloning..."
48+
mkdir -p ~/senpro/499337/modul02
49+
cd ~/senpro/499337/modul02
50+
git clone git@github.com:abeputra/senpro-github-action.git
51+
else
52+
echo "Repository sudah ada. Building..."
53+
cd ~/senpro/499337/modul02/senpro-github-action
54+
git restore .
55+
git pull origin main
56+
fi
57+
58+
echo "Install Package dan Build Project"
59+
npm install
60+
npm run build

0 commit comments

Comments
 (0)