Skip to content

Deploy

Deploy #11

Workflow file for this run

name: Deploy
concurrency:
group: production
on:
workflow_dispatch:
jobs:
deployment:
runs-on: ubuntu-latest
environment:
name: production
url: https://pix.cloud.ut.ee/
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Set up Ansible
run: |
sudo apt-get update
sudo apt-get install --only-upgrade openssl
sudo apt-get install -y python3-pip
pip3 install -U pip ansible pyyaml
ansible --version
docker --version
- name: Set known hosts
id: known_hosts
run: |
{
echo 'KNOWN_HOSTS<<EOF'
ssh-keyscan -t rsa,ecdsa,ed25519 193.40.11.243
ssh-keyscan -t rsa,ecdsa,ed25519 193.40.11.123
ssh-keyscan -t rsa,ecdsa,ed25519 193.40.11.119
} >> "$GITHUB_ENV"
- name: Debug KNOWN_HOSTS
run: echo "$KNOWN_HOSTS"
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: "${{ secrets.PIX_SSH_KEY }}"
known_hosts: "$KNOWN_HOSTS"
name: "pix"
- name: Unpack secrets to "./secrets/"
run: |
echo "${{ secrets.SECRETS_TAR_GZ_B64 }}" | base64 -d | tar xz
- name: Deploy with Ansible
run: |
ansible-playbook -i ansible/hosts.yaml --private-key ~/.ssh/pix ansible/deploy.yaml