diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..eb84af90 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,66 @@ +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 }} + - name: Install dependencies + run: npm i + - name: Build project + 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/ssh-praktikan60; + echo "Cek folder project"; + [ ! -d "${HOME}/senpro/493982/modul02/senpro-github-action/" ] && + { + echo "Repository belum di-clone. Cloning..."; + mkdir -p ~/senpro/493982/modul02; + cd ~/senpro/493982/modul02; + git clone https://github.com/ranisedangbekerja/senpro-github-action.git; + cd ~/senpro/494013/modul02/senpro-github-action; + echo "Install Package dan Build Project"; + npm install; + npm run build; + } || + { + echo "Repository sudah ada. Building..."; + cd ~/senpro/493982/modul02/senpro-github-action; + git restore; + git pull origin main; + echo "Install Package dan Build Project"; + npm install; + npm run build; + } diff --git a/src/pages/index.js b/src/pages/index.js index ba9f0517..fa164e94 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -30,7 +30,7 @@ export default function Home() {
- [Nama] | [NIU] + [Rani Nirmala Prakoso] | [493982]