diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..e4b1d6ac --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,51 @@ +name: CI/CD Pipeline +on: + push: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Uninstall Node.js and npm + run: | + sudo apt-get remove --purge nodejs npm + sudo apt-get autoremove + sudo apt-get autoclean + + - name: Setup Node.js and npm + uses: actions/setup-node@v3 + with: + node-version: '14' + npm : 'latest' + + # - name: Use Python 3.12.0 + # uses: actions/setup-python@v2 + # with: + # python-version: '3.12.0' + + - name: Clear npm cache + run: npm cache clean --force + + + - name: Install dependencies + run: | + npm install -g npm@latest + npm install + + - name: Build + run: npm run build + + - name: Deploy to AWS + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + - run: | + aws s3 sync build/ s3://techdome-jenkins-cicd-bucket/ + aws cloudfront create-invalidation --distribution-id E1IUL1R5EKH6RA --paths "/*" diff --git a/package.json b/package.json index 6a643870..529e4a09 100644 --- a/package.json +++ b/package.json @@ -81,4 +81,8 @@ }, "author": "", "license": "MIT" +}, +"engines": { + "node": "18.17.0", + "npm": "latest" }