From 08791853e404412696ed198a029ffb4dd41a7636 Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 22 Feb 2024 21:56:22 +0530 Subject: [PATCH] add pipeline --- .github/workflows/deploy.yml | 39 ++++++++++++++++++++++++++++++++++++ pages/sitemap.xml.js | 1 + 2 files changed, 40 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..4a37a40 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,39 @@ +name: Deploy OCI to EC2 + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Rename .next to .next2 + run: mv .next .next2 + + - name: Send .next2 to EC2 + uses: appleboy/scp-action@master + with: + host: ${{ secrets.EC2_HOST_OCI }} + username: ${{ secrets.EC2_USERNAME }} + key: ${{ secrets.EC2_PRIVATE_KEY_OCI }} + source: .next2 + target: oci-assam-frontend + - name: Update with new Build + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.EC2_HOST_OCI }} + username: ${{ secrets.EC2_USERNAME }} + key: ${{ secrets.EC2_PRIVATE_KEY_OCI }} + script: rm -rf oci-assam-frontend/.next; mv oci-assam-frontend/.next2 oci-assam-frontend/.next; pm2 restart oci-assam-frontend diff --git a/pages/sitemap.xml.js b/pages/sitemap.xml.js index b55d51a..c82b0ed 100644 --- a/pages/sitemap.xml.js +++ b/pages/sitemap.xml.js @@ -14,6 +14,7 @@ export const getServerSideProps = async function ({ res }) { '_app.tsx', '_document.tsx', '_error.tsx', + 'sitemap_index.xml.js', 'sitemap.xml.js', 'index.tsx', '[state]',