-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6874f72
commit d10dc03
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Build and Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
permissions: | ||
contents: read | ||
id-token: write | ||
jobs: | ||
build_push: | ||
environment: ${{ github.head_ref || github.ref_name }} | ||
runs-on: ubuntu-latest | ||
container: | ||
image: node:20-alpine3.17 | ||
env: | ||
AWS_BUCKET: ${{ vars.AWS_BUCKET }} | ||
name: Build & deploy | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- 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: ${{ vars.AWS_DEFAULT_REGION }} | ||
- name: Install dependencies | ||
run: | | ||
apk update | ||
apk add --no-cache aws-cli | ||
- name: NPM build | ||
run: | | ||
npm install --legacy-peer-deps | ||
npm run build | ||
- name: Sync website to S3 | ||
run: | | ||
cd dist | ||
aws s3 sync . s3://${AWS_BUCKET} --delete |