-
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
Josh Stillman
committed
Sep 7, 2023
1 parent
9c3263d
commit 275e183
Showing
2 changed files
with
63 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,43 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
# Build job | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
NEXT_PUBLIC_API_URL: ${{ secrets.API_URL }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
cache: "npm" | ||
- name: Restore cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
.next/cache | ||
# Generate a new cache whenever packages or source files change. | ||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | ||
# If source files changed but packages didn't, rebuild from a prior cache. | ||
restore-keys: | | ||
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | ||
- name: Install Modules | ||
run: npm ci | ||
- name: Build Application | ||
run: npm run build | ||
|
||
# Deploy to AWS | ||
- name: Configure AWS | ||
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: us-east-1 | ||
- name: Deploy to S3 | ||
run: aws s3 sync ./out s3://${{ secrets.BUCKET_NAME }} --delete | ||
- name: Create Cloudfront Invalidation | ||
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*" |
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,20 @@ | ||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["dev"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "frontend-dev" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build-deploy-dev: | ||
uses: ./.github/workflows/dev.yml | ||
environment: dev | ||
secrets: inherit | ||
|