This repository has been archived by the owner on Aug 18, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (59 loc) · 1.75 KB
/
cd-staging.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: CD(staging)
on: # 検証用。マージ時に修正する。
push:
branches:
- feature/staging
workflow_dispatch:
jobs:
push-image:
runs-on: ubuntu-latest
environment: stg
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/twin-te/twinte-back
tags: stg
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: deploy.Dockerfile
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
runs-on: ubuntu-latest
needs: push-image
environment: stg
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy to app server
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.APP_HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: ~/twinte-infra-v4/staging/app/scripts/deploy-back.sh
- name: Deploy to db server
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.DB_HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: ~/twinte-infra-v4/staging/db/scripts/deploy-back.sh