CI/CD for docs #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy Docs to AWS S3 | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'apps/docs/**' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 # Use the version matching your project | |
# Step 3: Install dependencies and build the app | |
- name: Install dependencies and build | |
run: | | |
npm ci | |
npm run build | |
# Step 4: Configure AWS CLI | |
- name: Configure AWS CLI | |
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: ${{ secrets.AWS_REGION }} | |
# Step 5: Upload to S3 | |
- name: Upload to S3 | |
run: aws s3 sync ./apps/docs/build s3://docs.bsamaritan.com --delete |