File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,6 +160,35 @@ jobs:
160160 docker image ls --filter reference=openplatform/open-state:${{ github.event.release.tag_name }} -q | tail -n +4 | xargs --no-run-if-empty docker image rm
161161
162162
163+ deploy-production :
164+ name : Deploy Production
165+ runs-on : ubuntu-latest
166+ continue-on-error : false
167+ needs : [tests, build, package, deploy-sprint]
168+
169+ steps :
170+
171+ - name : Checkout repository
172+ uses : actions/checkout@v2
173+
174+ - name : Deploy server
175+ run : |
176+ sudo apt install openssh-client
177+ sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
178+ eval $(ssh-agent -s)
179+ echo "${{ secrets.PROD_DEPLOY_SSH_KEY }}" | tr -d '\r' | ssh-add - > /dev/null
180+ mkdir -p ~/.ssh
181+ chmod 700 ~/.ssh
182+ ssh-keyscan ${{ secrets.PROD_SERVER }} >> ~/.ssh/known_hosts
183+ chmod 644 ~/.ssh/known_hosts
184+ export DOCKER_HOST="ssh://gitlab@${{ secrets.PROD_SERVER }}"
185+ export MONGODB_PASSWORD="${{ secrets.PROD_MONGO_PASSWORD }}"
186+ export DOCKER_IMAGE_TAG="openplatform/open-state:${{ github.event.release.tag_name }}"
187+ docker login -u ${{ secrets.DOCKERHUB_USER_NAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
188+ docker-compose -f docker-compose-server.yml up -d
189+ docker image ls --filter reference=openplatform/open-state:${{ github.event.release.tag_name }} -q | tail -n +4 | xargs --no-run-if-empty docker image rm
190+
191+
163192
164193
165194
You can’t perform that action at this time.
0 commit comments