made changes #16
This file contains hidden or 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 application stack | |
| on: | |
| push: | |
| branches: deployment | |
| jobs: | |
| deploy: | |
| name: Deploy to provisioned infrastructure | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout repository | |
| uses: actions/checkout@v4 | |
| - name: deploy to vm | |
| uses: appleboy/ssh-action@v1.2.0 | |
| with: | |
| host: deltronfr.mooo.com | |
| username: ${{ secrets.TF_VARS_ADMIN_USERNAME }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| port: ${{ secrets.PORT }} | |
| script: | | |
| echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| if [ ! -d "full-stack_gitops/.git" ]; then | |
| git clone --branch deployment git@github.com:deltron-fr/full-stack_gitops.git full-stack_gitops | |
| fi | |
| cd full-stack_gitops | |
| git pull origin deployment | |
| cd application/ | |
| echo "${{ secrets.DOCKER_ENV_FILE }}" > .env | |
| echo "${{ secrets.VITE_API_URL }}" > frontend/.env | |
| echo "${{ secrets.ENV_FILE }}" > backend/.env | |
| sudo docker compose -f compose.app.yaml down --volumes || true | |
| sudo docker compose -f compose.app.yaml up -d --force-recreate |