Skip to content

Merge pull request #39 from bescka/test_auth #17

Merge pull request #39 from bescka/test_auth

Merge pull request #39 from bescka/test_auth #17

name: Deploy on Push
# test change
# another test change
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS credentials from Github OIDC
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: ${{secrets.ROLE_TO_ASSUME}}
aws-region: ${{secrets.AWS_REGION}}
- name: Pull latest code on remote server
run: |
aws ssm send-command \
--instance-ids ${{secrets.AWS_INSTANCE_ID}} \
--document-name "AWS-RunShellScript" \
--comment "Pull latest code" \
--parameters 'commands=cd ${{ secrets.WORK_DIR }} && && git checkout main && git pull' \
--timeout-seconds 60 \
- name: Manage Docker Compose on remote server
run: |
aws ssm send-command \
--instance-ids ${{secrets.AWS_INSTANCE_ID}} \
--document-name "AWS-RunShellScript" \
--comment "Manage Docker Compose" \
--parameters 'commands=cd ${{ secrets.WORK_DIR }} && \
docker-compose down && \
docker rmi file_uploader-backend:latest || true && \
docker rmi file_uploader-frontend:latest || true && \
docker-compose pull && \
docker-compose up -d' \
--timeout-seconds 60 \