host continuous deploy git actions and runner
This commit is contained in:
@@ -1,17 +1,50 @@
|
|||||||
name: deploy host
|
name: deploy host
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths_ignore:
|
paths-ignore:
|
||||||
- "services/**"
|
- "services/**"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- ".gitea/workflows/**services**.yml"
|
- ".gitea/workflows/**services**.yml"
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
setup-runner:
|
||||||
runs-on: ubuntu-latest
|
runs-on: homesrv01
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
volumes:
|
||||||
|
- workspace:/workspace
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Build project
|
|
||||||
|
- name: build git runner
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
npm install
|
docker build ${{gitea.workspace}}/services/git-runner --tag homesrv/git-runner
|
||||||
npm run build
|
|
||||||
|
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}}
|
||||||
|
|||||||
3
services/git-runner/Dockerfile
Normal file
3
services/git-runner/Dockerfile
Normal 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
|
||||||
|
|
||||||
Reference in New Issue
Block a user