Add Deploy Github Action #8
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: Deploy to S3 | |
on: | |
push: | |
branches: | |
- main # This triggers the workflow on push to the main branch | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' # Use the Node.js version you need | |
- name: Install dependencies | |
run: npm install | |
- name: Build the Next.js app | |
run: npm run build | |
- name: Configure AWS credentials | |
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: eu-central-1 # Change to your AWS region | |
- name: Sync S3 bucket | |
run: aws s3 sync ./out s3://jakobheine.de --delete | |
# --delete flag ensures that files deleted locally are also deleted from the bucket |