Merge pull request #128 from Clean-CaDET/development #53
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
deploy: | |
name: Deployment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get the version | |
id: get-tag | |
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
target: gatewayWithFront | |
build-args: SMART_TUTOR_API_URL=https://clean-cadet.com/smart-tutor/api/ | |
push: true | |
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tutor-ui-web:${{steps.get-tag.outputs.tag}} | |
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/tutor-ui-web:buildcache | |
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/tutor-ui-web:buildcache,mode=max | |
- name: Deploy service | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
docker service update \ | |
--image ${{ secrets.DOCKER_HUB_USERNAME }}/tutor-ui-web:${{steps.get-tag.outputs.tag}} \ | |
--force clean_cadet_public_dev_gateway | |
- name: Build and push ftnInf | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
target: gatewayWithFront | |
build-args: SMART_TUTOR_API_URL=https://tutor.ftninformatika.com/smart-tutor/api/ | |
push: true | |
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tutor-ui-ftninf:${{steps.get-tag.outputs.tag}} | |
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/tutor-ui-ftninf:buildcache | |
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/tutor-ui-ftninf:buildcache,mode=max | |
- name: Deploy service ftnInf | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.FTN_INF_SSH_HOST }} | |
username: ${{ secrets.FTN_INF_SSH_USERNAME }} | |
key: ${{ secrets.FTN_INF_SSH_KEY }} | |
port: ${{ secrets.FTN_INF_SSH_PORT }} | |
script: | | |
docker service update \ | |
--image ${{ secrets.DOCKER_HUB_USERNAME }}/tutor-ui-ftninf:${{steps.get-tag.outputs.tag}} \ | |
--force clean_cadet_public_dev_gateway |