Skip to content

Commit

Permalink
testing connection to the api server
Browse files Browse the repository at this point in the history
  • Loading branch information
varsha1305nav committed Apr 2, 2024
1 parent 6fda19e commit 225bbd1
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/deploy_prod_api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy API - Prod

on:
push:
branches: [ github-actions-prod ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Get Github action IP
id: ip
uses: haythem/[email protected]
- name: Setting environment variables..
run: |
echo "AWS_DEFAULT_REGION=eu-west-2" >> $GITHUB_ENV
echo "AWS_SG_NAME=${{ secrets.AWS_SECURITY_GROUP_ID_PROD }}" >> $GITHUB_ENV
- name: Add Github Actions IP to Security group
run: |
aws ec2 authorize-security-group-ingress --group-id ${{ env.AWS_SG_NAME }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}

- name: Steps
uses: appleboy/ssh-action@master
continue-on-error: false
with:
host: ${{ secrets.PRODSERVER_API }}
username: ${{ secrets.USERNAME_PROD }}
key: ${{ secrets.SECRETKEY_PROD }}
command_timeout: 10m
script: |
cd xfluencer/influencer-marketplace
pwd
git status
- name: Remove Github Actions IP from security group
if: always()
run: |
aws ec2 revoke-security-group-ingress --group-id ${{ env.AWS_SG_NAME }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}

0 comments on commit 225bbd1

Please sign in to comment.