@@ -63,6 +63,10 @@ inputs:
63
63
description : " On prune true, Will cleanup exitied containers and unused images."
64
64
default : true
65
65
required : false
66
+ restart-only :
67
+ description : " On restart-only true, Service will be force restarted with set replicas."
68
+ default : false
69
+ required : false
66
70
67
71
runs :
68
72
using : " composite"
95
99
uses : aws-actions/amazon-ecr-login@v2
96
100
97
101
- name : EC2 Docker Service Deploy
102
+ if : ${{ inputs.restart-only != 'true' }}
98
103
uses : appleboy/ssh-action@master
99
104
with :
100
105
host : ${{ inputs.ssh-host }}
@@ -120,6 +125,21 @@ runs:
120
125
${{ inputs.ecr-image-uri }}
121
126
fi
122
127
128
+ - name : EC2 Docker Restart Service
129
+ if : ${{ inputs.restart-only == 'true' }}
130
+ uses : appleboy/ssh-action@master
131
+ with :
132
+ host : ${{ inputs.ssh-host }}
133
+ username : ${{ inputs.ssh-username }}
134
+ key : ${{ inputs.ssh-key }}
135
+ script : |
136
+ sudo docker login --username AWS -p $(aws ecr get-login-password --region ${{ inputs.aws-region }}) ${{ steps.login-ecr.outputs.registry }}
137
+ sudo docker pull ${{ inputs.ecr-image-uri }}
138
+ sudo -S docker service update \
139
+ --force \
140
+ --replicas ${{ inputs.replicas }} \
141
+ ${{ inputs.docker-service }}
142
+
123
143
- name : EC2 Prune conatiner and images
124
144
if : ${{ inputs.prune == 'true' }}
125
145
uses : appleboy/ssh-action@master
0 commit comments