Build nodejs site and upload in S3

    0

    10

    GitHub Actions

    Build a NodeJs/NextJs website and upload it to S3

    Shortcut: nextjs.s3

    Filename pattern: .github/workflows/*.yml

    name: CI
    on:
      push:
        branches:
          - main
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - name: Use Node.js ${{ matrix.node-version }}
            uses: actions/setup-node@v1
            with:
              node-version: 16.x
          - name: Install dependencies
            run: |
              npm i
          - name: Production Build
            run: |
              npm run build
          - name: Configure AWS Credentials
            uses: aws-actions/configure-aws-credentials@v1
            with:
              aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
              aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
              aws-region: ${{ secrets.AWS_REGION }}
          - name: Remove useless files
            run: rm -rf .github .git README.md
          - name: Deploy static site to S3 bucket
            run: aws s3 sync out s3://${{ secrets.S3_BUCKET }} --delete
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.