-
Notifications
You must be signed in to change notification settings - Fork 5
36 lines (29 loc) · 1.62 KB
/
ci.yaml
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
name: ci
on: [push, pull_request]
jobs:
deploy-test:
runs-on: ubuntu-latest
steps:
- name: check out repository
uses: actions/checkout@v2
- name: Remove entry from known_hosts
run: ssh-keygen -f "/home/runner/.ssh/known_hosts" -R "usegalaxy-test.cerit-sc.cz"
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Create SSH key
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
- name: Copy files to test instance and preserve secrets and hosts
run: |
rsync -rav * [email protected]:~/usegalaxy-${{ steps.date.outputs.date }}
ssh [email protected] 'cp ~/usegalaxy/group_vars/secret.yml ~/usegalaxy-${{ steps.date.outputs.date }}/group_vars'
ssh [email protected] 'cp ~/usegalaxy/hosts ~/usegalaxy-${{ steps.date.outputs.date }}'
ssh [email protected] 'cp ~/usegalaxy/.vault-password.txt ~/usegalaxy-${{ steps.date.outputs.date }}'
- name: Run playbook
run: |
# don't use "--force" here, some changes in roles were done manually and will be overwritten, see README.md
ssh [email protected] 'cd ~/usegalaxy-${{ steps.date.outputs.date }} && ansible-galaxy install -p roles -r requirements.yml'
ssh [email protected] 'cd ~/usegalaxy-${{ steps.date.outputs.date }} && ansible-playbook galaxy.yml'