From 201cc0c1b78db88c2bdc933975be77cd0bb740ab Mon Sep 17 00:00:00 2001 From: hieraar Date: Mon, 19 Feb 2024 09:31:35 +0700 Subject: [PATCH 1/5] Menambahkan .git / worflows dan main.yml --- .github/workflows/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..0694cae4 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,23 @@ +name: Test, Build, and Deploy | Modul 01 - Lab2.2 Senior Project + +on: + push: + branches: [main] + +jobs: + test-build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - uses: actions/checkout@v2 + - name: Testing Build pre-Deploy + uses: actions/setup-node@v2 + with: + node-version: ${{matrix.node-version}} + cache: "npm" + - run: npm i + - run: npm run build From 902b37db760f227a10d75c4e65840dfa5bb0aeff Mon Sep 17 00:00:00 2001 From: hieraar Date: Mon, 19 Feb 2024 10:02:10 +0700 Subject: [PATCH 2/5] Case 2 --- .github/workflows/main.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0694cae4..5f39ec73 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,3 +21,36 @@ jobs: cache: "npm" - run: npm i - run: npm run build + + deploy: + needs: test-build + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [16.x] + + steps: + - name: Build app on VM + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + port: ${{ secrets.PORT }} + script: | + eval "$(ssh-agent -s)" + ssh-add ~/.ssh/vm_senpro_modul2_61 + echo "Cek folder project"; + [ ! -d "${HOME}/senpro/473997/modul02/senpro-github-action/" ] && + { + echo "Repository belum di clone. Cloning..."; + mkdir -p ~/senpro/473997/modul02; + git clone git@github.com:hieraar/senpro-github-action.git; + } || + { + echo "Repository sudah ada. Building..."; + cd ~/senpro/473997/modul02/senpro-github-action; + git restore .; + git pull origin main; + } From 79fe55bcb8c35288df564f5f72f662164ac42bf0 Mon Sep 17 00:00:00 2001 From: hieraar Date: Mon, 19 Feb 2024 10:18:17 +0700 Subject: [PATCH 3/5] menambahkan cd --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f39ec73..1b06ffcd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,6 +46,7 @@ jobs: { echo "Repository belum di clone. Cloning..."; mkdir -p ~/senpro/473997/modul02; + cd ~/senpro/473997/modul02 git clone git@github.com:hieraar/senpro-github-action.git; } || { From 46e60ffd7c819eff9359f261f6e8494e25dec409 Mon Sep 17 00:00:00 2001 From: hieraar Date: Mon, 19 Feb 2024 10:25:33 +0700 Subject: [PATCH 4/5] Mengubah index.js --- src/pages/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/index.js b/src/pages/index.js index ba9f0517..f8f62565 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,7 +1,7 @@ -import Head from 'next/head' -import Image from 'next/image' -import { Inter } from '@next/font/google' -import styles from '@/styles/Home.module.css' +// import Head from 'next/head' +// import Image from 'next/image' +// import { Inter } from '@next/font/google' +// import styles from '@/styles/Home.module.css' const inter = Inter({ subsets: ['latin'] }) @@ -30,7 +30,7 @@ export default function Home() {
- [Nama] | [NIU] + [Hiera Ahmaddhio Rhesadewa] | [473997]
From d1db289f4ad00f790c5725783ed0db0d4bd7ce25 Mon Sep 17 00:00:00 2001 From: hieraar Date: Mon, 19 Feb 2024 10:29:25 +0700 Subject: [PATCH 5/5] case 4 --- src/pages/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/index.js b/src/pages/index.js index f8f62565..ede55b12 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,7 +1,7 @@ -// import Head from 'next/head' -// import Image from 'next/image' -// import { Inter } from '@next/font/google' -// import styles from '@/styles/Home.module.css' +import Head from 'next/head' +import Image from 'next/image' +import { Inter } from '@next/font/google' +import styles from '@/styles/Home.module.css' const inter = Inter({ subsets: ['latin'] })