try to test be workflows #3
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: Production | |
on: | |
pull_request: | |
types: [labeled] | |
jobs: | |
deploy-backend: | |
if: "${{ github.event.label.name == 'prod: backend' }}" | |
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" | |
- name: Deploy to EC2 instance | |
uses: peterkimzz/[email protected] | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
instance-ids: ${{ secrets.AWS_INSTANCE_ID }} | |
# Command execution location | |
working-directory: /home/ubuntu | |
command: | | |
sudo docker-compose stop | |
sudo docker-compose rm -f | |
sudo docker-compose pull | |
sudo docker-compose up -d | |
sudo docker image prune -af |