.github/workflows/Backend-cd.yml #10
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: Backend-cd | |
on: | |
workflow_run: | |
workflows: ['Backend-ci'] | |
types: [completed] | |
branches: [main] | |
pull_request: | |
types: [labeled] | |
jobs: | |
deploy-git: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Remove deploy label | |
uses: actions-ecosystem/action-remove-labels@v1 | |
with: | |
labels: "prod: backend" | |
deploy-aws: | |
needs: deploy-git | |
runs-on: aws-nft | |
steps: | |
- name: stop old image | |
run: sudo docker-compose stop | |
- name: remove old image | |
run: sudo docker-compose rm -f | |
- name: pull new image | |
run: sudo docker-compose pull | |
- name: run new image | |
run: sudo docker-compose up -d | |
- name: prune images | |
run: sudo docker image prune -af |