Skip to content

Commit

Permalink
Use a GitHub action to setup ssh-agent, remove unnecessary pipenv ins…
Browse files Browse the repository at this point in the history
…tall (#170)
  • Loading branch information
egeakman authored Jul 14, 2024
1 parent e3403ac commit 216bdc0
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.11.4'
- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- run: pipenv install --dev
- name: Setup ssh
shell: bash

- name: Install Ansible
run: |
service ssh status
eval `ssh-agent -s`
mkdir /home/runner/.ssh
touch /home/runner/.ssh/id_rsa
chmod 700 /home/runner/.ssh/id_rsa
echo -e "${{secrets.ANSIBLE_DEPLOY_SSH_KEY}}" > /home/runner/.ssh/id_rsa
ssh-keyscan -t ed25519 ${{secrets.BOT_HOST_IP}} >> /home/runner/.ssh/known_hosts
sudo apt update
sudo apt install -y ansible
- name: Set up SSH agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.DISCORD_BOT_DEPLOY_KEY }}

- name: Deploy EuroPythonBot with ansible
run: pipenv run ansible-playbook -i ansible/inventory.ini ansible/deploy-playbook.yml --private-key="/home/runner/.ssh/id_rsa" --user=root
run: ansible-playbook -i ansible/inventory.ini ansible/deploy-playbook.yml --private-key="/home/runner/.ssh/id_rsa" --user=root
env:
ANSIBLE_HOST_KEY_CHECKING: "false"

0 comments on commit 216bdc0

Please sign in to comment.