host continuous deploy git actions and runner
This commit is contained in:
@@ -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}}
|
||||
|
||||
Reference in New Issue
Block a user