-
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.
Merge pull request #16 from ky0yk/feat/separate-environments
環境の分離 (dev, stg)およびGitHubActionsの有効化
- Loading branch information
Showing
11 changed files
with
1,851 additions
and
19,761 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,48 @@ | ||
name: cdk | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
jobs: | ||
aws_cdk: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Main Branch Check | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
run: echo "SYSTEM_ENV=stg" >> $GITHUB_ENV | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14.x" | ||
|
||
- name: Setup dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn run build | ||
|
||
- name: Unit tests | ||
if: contains(github.event_name, 'pull_request') | ||
run: yarn run test | ||
|
||
- name: CDK Diff Check | ||
if: contains(github.event_name, 'pull_request') | ||
run: yarn run cdk diff | ||
env: | ||
AWS_DEFAULT_REGION: "ap-northeast-1" | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
|
||
- name: CDK Deploy | ||
if: contains(github.event_name, 'push') | ||
run: yarn run deploy | ||
env: | ||
AWS_DEFAULT_REGION: "ap-northeast-1" | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
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
File renamed without changes.
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
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
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,29 @@ | ||
export class ResourceName { | ||
public readonly systemName: string; | ||
public readonly systemEnv: string; | ||
|
||
constructor(systemName: string, systemEnv: string) { | ||
this.systemName = systemName; | ||
this.systemEnv = systemEnv; | ||
} | ||
|
||
private basicName(name: string): string { | ||
return `${this.systemName}-${this.systemEnv}-${name}`; | ||
} | ||
|
||
public apiName(name: string): string { | ||
return this.basicName(`${name}-api`); | ||
} | ||
|
||
public lambdaName(name: string): string { | ||
return this.basicName(`${name}-function`); | ||
} | ||
|
||
public dynamodbName(name: string): string { | ||
return this.basicName(`${name}-table`); | ||
} | ||
|
||
public stackName(name: string): string { | ||
return this.basicName(`${name}-stack`); | ||
} | ||
} |
Oops, something went wrong.