2024-10-06 01:10:10 +10:00
|
|
|
name: Deploy
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
name: Prepare Build
|
|
|
|
runs-on: homelab
|
2024-11-08 22:50:05 +10:00
|
|
|
container: git.comprofix.com/mmckinnon/alpine-runner:latest
|
2024-10-06 01:10:10 +10:00
|
|
|
steps:
|
2024-10-28 21:47:42 +10:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
apk update
|
|
|
|
apk add --no-cache openssh
|
2024-10-28 22:03:07 +10:00
|
|
|
apk add --no-cache nodejs npm git bash openssh python3 py3-pip py3-passlib
|
|
|
|
python3 -m pip install --user ansible --break-system-packages
|
2024-10-28 22:00:16 +10:00
|
|
|
export PATH="/root/.local/bin:$PATH"
|
2024-10-28 22:03:07 +10:00
|
|
|
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2024-10-06 01:10:10 +10:00
|
|
|
|
|
|
|
- name: Deploy containers
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
echo "${{ secrets.SSH_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
|
2024-10-28 22:09:56 +10:00
|
|
|
chmod 644 ~/.ssh/known_hosts
|
2024-10-06 01:10:10 +10:00
|
|
|
eval $(ssh-agent -s)
|
|
|
|
ssh-add <(echo "${{ secrets.SSH_PRIVATE_KEY }}")
|
|
|
|
echo "HOST *" > ~/.ssh/config
|
|
|
|
echo "StrictHostKeyChecking no" >> ~/.ssh/config
|
|
|
|
echo "${{ secrets.ANSIBLE_VAULT_PASSWORD }}" > ~/.vault_password.txt
|
|
|
|
echo "nameserver 10.10.10.1" > /etc/resolv.conf
|
2024-10-28 22:03:07 +10:00
|
|
|
./.gitea/workflows/deploy.sh "${{ github.event.before }}" "${{ github.sha }}"
|
2024-10-06 01:10:10 +10:00
|
|
|
|
|
|
|
|