minor: service card minor fixes if the influencer is not logged in #274
This file contains 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 API | |
on: | |
push: | |
branches: [ main ] | |
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 }}" >> $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.DEVSERVER }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SECRETKEY }} | |
command_timeout: 50m | |
script: | | |
cd xfluencer/influencer-marketplace | |
git pull | |
cd src/api/marketplace | |
source venv/bin/activate | |
pip3 install -r requirements.txt | |
pip3 install pyxfluencer-1.0.2-py3-none-any.whl | |
python3 manage.py migrate | |
python3 manage.py collectstatic -link --noinput | |
sudo systemctl restart nginx | |
sudo supervisorctl restart marketplace | |
- 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 }} |