diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..a99d4eed --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,35 @@ +name: Deploy Helpdesk with Ansible + +on: + pull_request: + branches: [development] + types: [closed] + +permissions: + contents: read + +concurrency: + group: deploy-helpdesk + cancel-in-progress: true + +jobs: + deploy: + if: github.event.pull_request.merged == true + name: Deploy Helpdesk to Production Server + runs-on: ubuntu-latest + + steps: + - name: Checkout Ansible Code + uses: actions/checkout@v4 + + - name: Deploy via SSH using appleboy/ssh-action + uses: appleboy/ssh-action@v1.2.0 + with: + host: ${{ secrets.CICD_SERVER_IP }} + username: ${{ secrets.CICD_SERVER_USER }} + key: ${{ secrets.CICD_SERVER_PRIVATE_KEY }} + port: ${{ secrets.CICD_SERVER_PORT }} + script: | + set -euo pipefail + cd ${{ secrets.CICD_SERVER_PATH }} + ansible-playbook -i inventories/production/inventory.yml playbooks/deploy-helpdesk.yml