diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..03173416 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,57 @@ +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 + + 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_45 + echo "Checking project folder..." + [ ! -d "${HOME}/senpro/477293/modul02/senpro-github-action/" ] && + { + echo "Repository not cloned. Cloning..."; + mkdir -p ~/senpro/477293/modul02; + cd ~/senpro/477293/modul02; + git clone https://github.com/daffakamal/senpro-github-action.git; + } || + { + echo "Repository already exists. Building..."; + cd ~/senpro/477293/modul02/senpro-github-action; + git restore .; + git pull origin main; + } \ No newline at end of file diff --git a/src/pages/index.js b/src/pages/index.js index ba9f0517..698ae504 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'] })