Skip to content

Commit c8f1612

Browse files
committed
cd: [KAN-150] swam deploy workflow
1 parent 2945252 commit c8f1612

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ on:
1414
default: 'deploy'
1515
type: choice
1616
options:
17+
- build
1718
- deploy
19+
- swarm-deploy
1820
- restart
1921
- rollback
2022

@@ -37,7 +39,7 @@ jobs:
3739
name: env-file
3840
path: env-file
3941
build:
40-
if: ${{ github.event.inputs.command == 'deploy' }}
42+
if: ${{ github.event.inputs.command == 'deploy' }} || ${{ github.event.inputs.command == 'build' }} || ${{ github.event.inputs.command == 'swarm-deploy' }}
4143
runs-on: ubuntu-latest
4244
env:
4345
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
@@ -104,3 +106,16 @@ jobs:
104106
docker stop ceramicraft-user-mservice || true
105107
docker rm ceramicraft-user-mservice || true
106108
docker run -d --name ceramicraft-user-mservice --network ceramicraft-network -v /home/ubuntu/logs:/app/logs --env-file env-file "${DOCKER_HUB_USERNAME}/ceramicraft-user-mservice:${{ github.event.inputs.version }}"
109+
swarm-deploy:
110+
if: ${{ github.event.inputs.command == 'swam-deploy' }}
111+
runs-on: self-hosted
112+
needs: build
113+
env:
114+
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
115+
steps:
116+
- name: pull the docker image
117+
run: |
118+
docker pull "${DOCKER_HUB_USERNAME}/ceramicraft-user-mservice:${{ github.event.inputs.version }}"
119+
- name: update the service
120+
run: |
121+
docker service update --force --image "${DOCKER_HUB_USERNAME}/ceramicraft-user-mservice:${{ github.event.inputs.version }}" ms-stack_user-ms || true

0 commit comments

Comments
 (0)