Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #11

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Test #11

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
DB_NAME: ${{ secrets.DB_NAME }}
DB_SCHEMA: ${{ secrets.DB_SCHEMA }}
DB_URL: postgresql://${{ secrets.DB_USER}}:${{secrets.DB_PASSWORD}}@${{secrets.DB_HOST}}:${{secrets.DB_PORT}}/${{secrets.DB_NAME}}?schema=${{secrets.DB_SCHEMA}}
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
HOSTNAME: ${{secrets.SSH_HOST}}
USER_NAME: ${{secrets.USER_NAME}}

steps:
- name: Checkout Code
Expand Down Expand Up @@ -53,10 +50,19 @@ jobs:

- name: Deploy to AWS EC2
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} '

# Now we have got the access of EC2 and we will start the deploy .
echo vasco > vasco.txt
echo "conectei via ssh github actions"
'
mkdir -p ~/.ssh/
echo "$PRIVATE_KEY" > ~/.ssh/github-actions-private_key
chmod 600 ~/.ssh/github-actions-private_key
cat >>~/.ssh/config <<END
Host ec2
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/github-actions-key
StrictHostKeyChecking no
END
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
USER_NAME: ${{secrets.USER_NAME}}
HOSTNAME: ${{secrets.SSH_HOST}}
- name: List home directory
run: ssh ec2 'ls -la'
Loading