Skip to content

Commit

Permalink
Merge pull request #115 from sharehouse-sanhaimu/cicd/aiwaki/deploy
Browse files Browse the repository at this point in the history
[CICD] mainにpush時に自動的にデプロイするためのWorkflowを追加
  • Loading branch information
nose221834 authored Mar 30, 2024
2 parents 687c0ae + e31de20 commit a33dd9a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/auto_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Auto Deploy
run-name: ChatGP is deploying
on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST_HACKASON}}
username: ${{ secrets.SSH_USERNAME_HACKASON}}
key: ${{ secrets.SSH_PRIVATE_KEY_HACKASON}}
port: ${{ secrets.SSH_PORT_HACKASON}}
script: |
cd ~/ChatGP
git pull origin main
git checkout main
bash script/down.sh
bash script/up.sh
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,26 @@ docker compose -f docker-compose.prod.yml run --rm view yarn build
docker compose -f docker-compose.prod.yml up -d
```

### Deletion

```bash
docker compose -f docker-compose.prod.yml down
```

### Use Script

Installtionをまとめて実行

```bash
$ bash ./script/up.sh
```

Deletionを実行

```bash
$ bash ./script/down.sh
```

## File Structure

- `api/`
Expand All @@ -34,6 +54,9 @@ docker compose -f docker-compose.prod.yml up -d

- Next.js を用いてフロントエンドを構築

- `script/`

- インストールや削除を行うシェルスクリプト

- `docker-compose.yml`
- 複数のコンテナを定義し、実行するための設定
Expand Down
1 change: 1 addition & 0 deletions script/down.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker-compose -f docker-compose.prod.yml down
4 changes: 4 additions & 0 deletions script/up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docker-compose -f docker-compose.prod.yml build
docker compose -f docker-compose.prod.yml run --rm view yarn
docker compose -f docker-compose.prod.yml run --rm view yarn build
docker compose -f docker-compose.prod.yml up -d

0 comments on commit a33dd9a

Please sign in to comment.