host continuous deploy git actions and runner
All checks were successful
deploy host / setup-runner (push) Successful in 6s
deploy host / ansible-playbook (push) Successful in 14s

This commit is contained in:
2024-09-01 04:27:39 +01:00
parent b4ea989516
commit 103039e049
2 changed files with 42 additions and 6 deletions

View File

@@ -1,17 +1,50 @@
name: deploy host
on:
push:
paths_ignore:
paths-ignore:
- "services/**"
- "docs/**"
- ".gitea/workflows/**services**.yml"
jobs:
build:
runs-on: ubuntu-latest
setup-runner:
runs-on: homesrv01
container:
image: catthehacker/ubuntu:act-latest
volumes:
- workspace:/workspace
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project
- name: build git runner
shell: bash
run: |
npm install
npm run build
docker build ${{gitea.workspace}}/services/git-runner --tag homesrv/git-runner
ansible-playbook:
runs-on: homesrv01
container:
image: homesrv/git-runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up SSH
run: |
echo "${{secrets.SSH_PRIVATE_KEY}}" > ~/.ssh/private_key.pem
chmod 600 ~/.ssh/private_key.pem
- name: get version
run: |
lsb_release -a
- name: Run Ansible Playbook
env:
ANSIBLE_HOST_KEY_CHECKING: False
ANSIBLE_BECOME_PASS: ${{secrets.ANSIBLE_BECOME_PASS}}
run: |
ansible-playbook -i ${{secrets.SERVER_ADDRESS}}, ${{gitea.workspace}}/ansible/site.yml --private-key ~/.ssh/private_key.pem -u ${{secrets.ANSIBLE_USER}}

View File

@@ -0,0 +1,3 @@
FROM catthehacker/ubuntu:act-latest
RUN apt-get update && apt install software-properties-common && add-apt-repository --yes --update ppa:ansible/ansible && apt-get install -y ansible