feat(*): for the deployment use aws ssm instead of ssh #7
Workflow file for this run
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 Kaapi to EC2 Staging | |
| on: | |
| push: | |
| branches: | |
| - feat/frontend-cicd-deployment | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: AWS_STAGING_ENV | |
| permissions: | |
| packages: write | |
| contents: read | |
| attestations: write | |
| id-token: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v6 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Deploy via SSM | |
| run: | | |
| aws ssm send-command \ | |
| --instance-ids "${{ secrets.EC2_INSTANCE_ID }}" \ | |
| --document-name "AWS-RunShellScript" \ | |
| --parameters 'commands=["git config --global --add safe.directory ${{ secrets.BUILD_DIRECTORY }} && set -e && cd ${{ secrets.BUILD_DIRECTORY }} && git pull origin main && npm ci && npm run build && pm2 start ${{ secrets.PM2_APP_NAME }}"]' \ | |
| --region ${{ secrets.AWS_REGION }} |