diff --git a/.github/workflows/s3-cicd-dev.yml b/.github/workflows/s3-cicd-dev.yml new file mode 100644 index 0000000..c573c6f --- /dev/null +++ b/.github/workflows/s3-cicd-dev.yml @@ -0,0 +1,32 @@ +name: CICD-dev +on: + push: + branches: + - dev +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + + - 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: us-east-1 + + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Install Gatsby + run: npm install -g gatsby-cli + + - name: Build static site + run: npm install + run: gatsby build + + - name: Deploy static site to S3 bucket + run: aws s3 sync ./public/ s3://${{ secrets.AWS_DEV_WEBSITE_BUCKET }} --delete \ No newline at end of file diff --git a/buildspec.yaml b/buildspec.yaml deleted file mode 100644 index 5430691..0000000 --- a/buildspec.yaml +++ /dev/null @@ -1,26 +0,0 @@ -version: 0.2 - -phases: - install: - runtime-versions: - nodejs: 12 - commands: - - echo "Installing Gatsby..." - - npm install -g gatsby-cli - pre_build: - commands: - - echo "Installing Node packages..." - - npm install - build: - commands: - - echo "Build initiated..." - - gatsby build - post_build: - commands: - - echo "Synchronizing public directory..." - - aws s3 sync ./public/ s3://$PUBLIC_OUTPUT_BUCKET --delete - -artifacts: - base-directory: public - files: - - '**/*'