Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] chore: try to deploy #379

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/aws-amplify-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Deploy Next.js to AWS Amplify

on:
pull_request:
branches: [ "main" ]
paths:
- .github/workflows/aws-amplify-client.yml
- client/**
- assistant/**

env:
AWS_REGION: ${{ vars.AWS_REGION }}
NEXT_PUBLIC_API_DOMAIN: ${{ vars.NEXT_PUBLIC_API_DOMAIN }}
AMPLIFY_APP_ID: ${{ vars.AMPLIFY_APP_ID }}

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
defaults:
run:
working-directory: ./client

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::654654285942:role/Github-OIDC
audience: sts.amazonaws.com
aws-region: ${{ env.AWS_REGION }}

- name: Configure Amplify CLI
run: npm install -g @aws-amplify/cli

- name: Install Dependencies
run: npm install

- name: Build Amplify App
run: npm run build

- name: Initialize Amplify Environment
run: amplify init --appId ${{ env.AMPLIFY_APP_ID }} --envName dev --region ${{ env.AWS_REGION }} --yes

- name: Deploy to Amplify
run: amplify publish --yes
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,23 @@ next-env.d.ts
dist/
lui/src/style.css

#client/amplify-do-not-edit-begin
client/amplify\#current-cloud-backend
client/amplify.config/local-*
client/amplifylogs
client/amplifymock-data
client/amplifymock-api-resources
client/amplifybackend/client/amplify-meta.json
client/amplifybackend/.temp

node_modules/
aws-exports.js
awsconfiguration.json
client/amplifyconfiguration.json
client/amplifyconfiguration.dart
client/amplify-build-config.json
client/amplify-gradle-config.json
client/amplifytools.xcconfig
.secret-*
**.sample
#client/amplify-do-not-edit-end
32 changes: 32 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
node_modules/
aws-exports.js
awsconfiguration.json
amplify/configuration.json
amplify/configuration.dart
amplify-build-config.json
amplify-gradle-config.json
amplify/tools.xcconfig
.secret-*
**.sample

#amplify-do-not-edit-begin
amplify/\#current-cloud-backend
amplify/.config/local-*
amplify/logs
amplify/mock-data
amplify/mock-api-resources
amplify/backend/amplify-meta.json
amplify/backend/.temp
build/
dist/
node_modules/
aws-exports.js
awsconfiguration.json
amplifyconfiguration.json
amplifyconfiguration.dart
amplify-build-config.json
amplify-gradle-config.json
amplifytools.xcconfig
.secret-*
**.sample
#amplify-do-not-edit-end
19 changes: 19 additions & 0 deletions client/amplify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 1
applications:
- frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- .next/cache/**/*
- node_modules/**/*
appRoot: client
15 changes: 15 additions & 0 deletions client/amplify/#current-cloud-backend/amplify-meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"providers": {
"awscloudformation": {
"AuthRoleName": "amplify-petercat-dev-c7647-authRole",
"UnauthRoleArn": "arn:aws:iam::654654285942:role/amplify-petercat-dev-c7647-unauthRole",
"AuthRoleArn": "arn:aws:iam::654654285942:role/amplify-petercat-dev-c7647-authRole",
"Region": "ap-northeast-1",
"DeploymentBucketName": "amplify-petercat-dev-c7647-deployment",
"UnauthRoleName": "amplify-petercat-dev-c7647-unauthRole",
"StackName": "amplify-petercat-dev-c7647",
"StackId": "arn:aws:cloudformation:ap-northeast-1:654654285942:stack/amplify-petercat-dev-c7647/56237530-7188-11ef-a824-062b3052e3ed",
"AmplifyAppId": "dq9yo5b2al2tn"
}
}
}
10 changes: 10 additions & 0 deletions client/amplify/#current-cloud-backend/tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"Key": "user:Stack",
"Value": "{project-env}"
},
{
"Key": "user:Application",
"Value": "{project-name}"
}
]
17 changes: 17 additions & 0 deletions client/amplify/.config/project-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"projectName": "petercat",
"version": "3.1",
"frontend": "javascript",
"javascript": {
"framework": "react",
"config": {
"SourceDir": "src",
"DistributionDir": "build",
"BuildCommand": "npm run-script build",
"StartCommand": "npm run-script start"
}
},
"providers": [
"awscloudformation"
]
}
8 changes: 8 additions & 0 deletions client/amplify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Getting Started with Amplify CLI
This directory was generated by [Amplify CLI](https://docs.amplify.aws/cli).

Helpful resources:
- Amplify documentation: https://docs.amplify.aws.
- Amplify CLI documentation: https://docs.amplify.aws/cli.
- More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files.
- Join Amplify's community: https://amplify.aws/community/.
22 changes: 22 additions & 0 deletions client/amplify/backend/amplify-meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"providers": {
"awscloudformation": {
"AuthRoleName": "amplify-petercat-dev-c7647-authRole",
"UnauthRoleArn": "arn:aws:iam::654654285942:role/amplify-petercat-dev-c7647-unauthRole",
"AuthRoleArn": "arn:aws:iam::654654285942:role/amplify-petercat-dev-c7647-authRole",
"Region": "ap-northeast-1",
"DeploymentBucketName": "amplify-petercat-dev-c7647-deployment",
"UnauthRoleName": "amplify-petercat-dev-c7647-unauthRole",
"StackName": "amplify-petercat-dev-c7647",
"StackId": "arn:aws:cloudformation:ap-northeast-1:654654285942:stack/amplify-petercat-dev-c7647/56237530-7188-11ef-a824-062b3052e3ed",
"AmplifyAppId": "dq9yo5b2al2tn"
}
},
"hosting": {
"amplifyhosting": {
"service": "amplifyhosting",
"providerPlugin": "awscloudformation",
"type": "manual"
}
}
}
27 changes: 27 additions & 0 deletions client/amplify/backend/backend-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"hosting": {
"amplifyhosting": {
"providerPlugin": "awscloudformation",
"service": "amplifyhosting",
"type": "manual"
}
},
"parameters": {
"AMPLIFY_hosting_amplifyhosting_appId": {
"usedBy": [
{
"category": "hosting",
"resourceName": "amplifyhosting"
}
]
},
"AMPLIFY_hosting_amplifyhosting_type": {
"usedBy": [
{
"category": "hosting",
"resourceName": "amplifyhosting"
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Branch stack creation for AWS Amplify Console",
"Parameters": {
"env": {
"Type": "String"
},
"appId": {
"Type": "String"
},
"type": {
"Type": "String"
}
},
"Conditions": {
"isManual": {
"Fn::Equals": [
{
"Ref": "type"
},
"manual"
]
}
},
"Resources": {
"AmplifyBranch": {
"Condition": "isManual",
"Type": "AWS::Amplify::Branch",
"Properties": {
"BranchName": {
"Ref": "env"
},
"AppId": {
"Ref": "appId"
}
}
}
}
}
10 changes: 10 additions & 0 deletions client/amplify/backend/tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"Key": "user:Stack",
"Value": "{project-env}"
},
{
"Key": "user:Application",
"Value": "{project-name}"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type AmplifyDependentResourcesAttributes = {}
64 changes: 64 additions & 0 deletions client/amplify/cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"features": {
"graphqltransformer": {
"addmissingownerfields": true,
"improvepluralization": false,
"validatetypenamereservedwords": true,
"useexperimentalpipelinedtransformer": true,
"enableiterativegsiupdates": true,
"secondarykeyasgsi": true,
"skipoverridemutationinputtypes": true,
"transformerversion": 2,
"suppressschemamigrationprompt": true,
"securityenhancementnotification": false,
"showfieldauthnotification": false,
"usesubusernamefordefaultidentityclaim": true,
"usefieldnameforprimarykeyconnectionfield": false,
"enableautoindexquerynames": true,
"respectprimarykeyattributesonconnectionfield": true,
"shoulddeepmergedirectiveconfigdefaults": false,
"populateownerfieldforstaticgroupauth": true,
"subscriptionsinheritprimaryauth": false
},
"frontend-ios": {
"enablexcodeintegration": true
},
"auth": {
"enablecaseinsensitivity": true,
"useinclusiveterminology": true,
"breakcirculardependency": true,
"forcealiasattributes": false,
"useenabledmfas": true
},
"codegen": {
"useappsyncmodelgenplugin": true,
"usedocsgeneratorplugin": true,
"usetypesgeneratorplugin": true,
"cleangeneratedmodelsdirectory": true,
"retaincasestyle": true,
"addtimestampfields": true,
"handlelistnullabilitytransparently": true,
"emitauthprovider": true,
"generateindexrules": true,
"enabledartnullsafety": true,
"generatemodelsforlazyloadandcustomselectionset": false
},
"appsync": {
"generategraphqlpermissions": true
},
"latestregionsupport": {
"pinpoint": 1,
"translate": 1,
"transcribe": 1,
"rekognition": 1,
"textract": 1,
"comprehend": 1
},
"project": {
"overrides": true
}
},
"debug": {
"shareProjectConfig": true
}
}
7 changes: 7 additions & 0 deletions client/amplify/hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Command Hooks

Command hooks can be used to run custom scripts upon Amplify CLI lifecycle events like pre-push, post-add-function, etc.

To get started, add your script files based on the expected naming convention in this directory.

Learn more about the script file naming convention, hook parameters, third party dependencies, and advanced configurations at https://docs.amplify.aws/cli/usage/command-hooks
Loading
Loading