@@ -59,18 +59,18 @@ jobs:
59
59
strategy :
60
60
matrix :
61
61
include :
62
- - environment : staging
63
- branch : staging
64
- target_path : " ~/staging.mapdb.cncnet.org"
65
- compose_file : " docker-compose.prod.yml"
66
- nginx_conf : " docker/nginx.prod.conf"
67
- host : ${{ secrets. STAGING_SSH_HOST }}
62
+ # - environment: staging
63
+ # branch: staging
64
+ # target_path: "~/staging.mapdb.cncnet.org"
65
+ # compose_file: "docker-compose.prod.yml"
66
+ # nginx_conf: "docker/nginx.prod.conf"
67
+ # host-s-name: " STAGING_SSH_HOST"
68
68
- environment : production
69
69
branch : main
70
70
target_path : " ~/mapdb.cncnet.org"
71
71
compose_file : " docker-compose.prod.yml"
72
72
nginx_conf : " docker/nginx.prod.conf"
73
- host : ${{ secrets. PROD_SSH_HOST }}
73
+ host-s-name : " PROD_SSH_HOST"
74
74
75
75
steps :
76
76
- name : " Exit if not matching branch"
83
83
- name : Copy docker-compose and nginx config over ssh
84
84
uses : appleboy/scp-action@v0.1.7
85
85
with :
86
- host : ${{ matrix.host }}
86
+ host : ${{ secrets[ matrix.host-s-name] }}
87
87
username : ${{ secrets.SSH_USER }}
88
88
key : ${{ secrets.SSH_PRIVATE_KEY }}
89
89
source : " ${{ matrix.compose_file }},${{ matrix.nginx_conf }}"
@@ -92,14 +92,12 @@ jobs:
92
92
- name : SSH into server and deploy
93
93
uses : appleboy/ssh-action@v1.2.1
94
94
with :
95
- host : ${{ matrix.host }}
95
+ host : ${{ secrets[ matrix.host-s-name] }}
96
96
username : ${{ secrets.SSH_USER }}
97
97
key : ${{ secrets.SSH_PRIVATE_KEY }}
98
98
script : |
99
99
cd ${{ matrix.target_path }}
100
100
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
101
- envstr='${{ secrets.PROD_ENV_FILE }}'
102
- echo -e $envstr > .env
103
101
docker compose -f ${{ matrix.compose_file }} pull
104
102
docker compose -f ${{ matrix.compose_file }} down
105
103
docker compose -f ${{ matrix.compose_file }} up -d
0 commit comments