Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8441de3
init]プロジェクトの立ち上げ
Yulikepython Jan 19, 2025
cbd3606
init]Styleの追加
Yulikepython Jan 19, 2025
2d49ac6
init]パンくずリスト、内部リンクの追加
Yulikepython Jan 19, 2025
815f5a6
init]ライセンスの追加
Yulikepython Jan 19, 2025
b519518
init]規約類の追加、dompurifyによる実装
Yulikepython Jan 19, 2025
30acc6f
init]CI/CDの追加
Yulikepython Jan 20, 2025
1b1419a
Merge pull request #1 from Yulikepython/feature/init-プロジェクトの立ち上げ
Yulikepython Jan 20, 2025
7127fbc
init]cicdの修正
Yulikepython Jan 20, 2025
324ce53
Merge pull request #2 from Yulikepython/feature/init-プロジェクトの立ち上げ
Yulikepython Jan 20, 2025
5f16381
init]Serverless access keyの追加
Yulikepython Jan 20, 2025
a3c5b63
Merge pull request #3 from Yulikepython/feature/init-プロジェクトの立ち上げ
Yulikepython Jan 20, 2025
3f3948a
init]cicd修正: backendOK. frontendのみ
Yulikepython Jan 20, 2025
4127346
Merge pull request #4 from Yulikepython/feature/init-プロジェクトの立ち上げ
Yulikepython Jan 20, 2025
0ae79f0
init]READMEの修正
Yulikepython Jan 20, 2025
d886865
init]言語リンクの修正
Yulikepython Jan 20, 2025
57bf5ea
init]READMEの修正、English
Yulikepython Jan 20, 2025
213e746
Merge pull request #6 from Yulikepython/feature/init-プロジェクトの立ち上げ
Yulikepython Jan 20, 2025
2dd7574
テスト作成] frontendはカバー率40%でエラーなし
Yulikepython Jan 20, 2025
fed6189
init] backend TestOK
Yulikepython Jan 21, 2025
b90c0e8
Merge pull request #7 from Yulikepython/feature/init-プロジェクトの立ち上げ
Yulikepython Jan 21, 2025
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
79 changes: 79 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI/CD for Backend

on:
# --------------------------
# pull_request:
# => PRが作られたとき → テストのみ
# --------------------------
pull_request:
branches: [develop, main]

# --------------------------
# push:
# => develop, main に push
# → デプロイ (stageを切り替え)
# --------------------------
push:
branches: [develop, main]

jobs:
deploy-backend:
runs-on: ubuntu-latest

steps:
# (1) コード取得
- name: Check out code
uses: actions/checkout@v3

# (2) Node セットアップ
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18

# (3) 依存関係インストール
- name: Install dependencies
run: |
cd backend
npm ci

# (4) テスト実行
# → pull_request / push 両方で実行
- name: Run tests
run: |
cd backend
npm run test

# (5) AWS認証 (push時のみ)
- name: Configure AWS Credentials
if: ${{ github.event_name == 'push' }}
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: ${{ secrets.AWS_REGION }}

# (6) デプロイ (develop→dev, main→prod)
- name: Deploy
if: ${{ github.event_name == 'push' }}
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
run: |
cd backend
# Secrets から必要な変数を export
export BUCKET_NAME="${{ secrets.BUCKET_NAME }}"
export AWS_REGION="${{ secrets.AWS_REGION }}"

if [ "${{ github.ref_name }}" = "develop" ]; then
echo "Deploying to dev stage..."
export ALLOWED_REFERER="${{ secrets.ALLOWED_REFERER_DEV }}"
npm run deploy:dev # 例) package.json: "deploy:dev": "serverless deploy --stage dev"

elif [ "${{ github.ref_name }}" = "main" ]; then
echo "Deploying to prod stage..."
export ALLOWED_REFERER="${{ secrets.ALLOWED_REFERER_PROD }}"
npm run deploy:prod # 例) package.json: "deploy:prod": "serverless deploy --stage prod"

else
echo "Not on develop or main => Skip"
fi
99 changes: 99 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Frontend CI/CD

on:
pull_request:
branches: [develop, main]
push:
branches: [develop, main]

jobs:
# ---- 1) pull_request -> テストのみ ----
testOnPR:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest

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

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
working-directory: ./frontend
run: npm ci

- name: Run tests
working-directory: ./frontend
run: npm run test


# ---- 2) push to develop -> ステージングビルド & デプロイ ----
buildAndDeployDev:
if: github.event_name == 'push' && github.ref_name == 'develop'
runs-on: ubuntu-latest

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

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
working-directory: ./frontend
run: npm ci

- name: Build dev
working-directory: ./frontend
run: |
# Secretsから dev用のAPIエンドポイントなどを環境変数に注入
export VITE_API_BASE_URL="${{ secrets.DEV_API_BASE_URL }}"
npm run build:dev # 例: "build:dev": "vite build --mode dev"

- name: Deploy to S3 (dev)
working-directory: ./frontend
run: |
aws s3 sync dist s3://${{ secrets.S3_DEV_BUCKET }} --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}


# ---- 3) push to main -> 本番ビルド & デプロイ ----
buildAndDeployProd:
if: github.event_name == 'push' && github.ref_name == 'main'
runs-on: ubuntu-latest

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

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
working-directory: ./frontend
run: npm ci

- name: Build prod
working-directory: ./frontend
run: |
export VITE_API_BASE_URL="${{ secrets.PROD_API_BASE_URL }}"
npm run build:prod

- name: Deploy to S3 (prod)
working-directory: ./frontend
run: |
aws s3 sync dist s3://${{ secrets.S3_PROD_BUCKET }} --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# my custom
*/.env.*
!*/.env.sample
!frontend/.env.local
.idea/
dist/
.serverless/
coverage/

mdstream_project_summary.txt

/tmp
/out-tsc

/node_modules
*/node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
Expand Down
1 change: 1 addition & 0 deletions .summaryignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/package-lock.json
Loading
Loading