-
Notifications
You must be signed in to change notification settings - Fork 89
40 lines (39 loc) · 1.49 KB
/
update.yml
File metadata and controls
40 lines (39 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Update server
on:
workflow_run:
workflows: ["Docker Build (Docker Hub)"]
types:
- completed
workflow_dispatch:
jobs:
# Git clone our ansible-scripts repository (private)
git-clone-ansible-scripts:
name: Run Ansible Playbook to update Ruby
runs-on: ubuntu-latest
steps:
- name: Git Clone our Private Ansible Scripts
uses: actions/checkout@v3
with:
repository: Ruby-Network/ansible-scripts
token: ${{ secrets.GH_TOKEN }}
ref: main
- name: Install Ansible
run: |
sudo apt update
sudo apt install ansible -y
- name: Send Webhook to Discord about updating Ruby
run: |
curl -X POST -H 'Content-type: application/json' --data '{"content":"Updating Ruby..."}' ${{ secrets.DISCORD_WEBHOOK }}
- name: SSH Known hosts ignore
run: |
mkdir -p ~/.ssh
touch ~/.ssh/known_hosts
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
echo "StrictHostKeyChecking no" >> ~/.ssh/config
- name: Run Ansible Playbook
run: |
#we don't have ssh keys so we need to use the password
ansible-playbook -i ./hosts ./playbooks/ruby.yml --extra-vars "ansible_ssh_pass=${{ secrets.ANSIBLE_PASSWORD }}"
- name: Send Webhook to Discord about Ruby being updated
run: |
curl -X POST -H 'Content-type: application/json' --data '{"content":"Ruby has been updated! :tada:"}' ${{ secrets.DISCORD_WEBHOOK }}