Public Access
feat: add deploy workflow to push ARM release to OrangePi via Ansible
This commit is contained in:
1 parent
6a3e2ed4d1
commit
5a96a3c5b7
1 file changed
+48
@@ -0,0 +1,48 @@
|
||||
name: Deploy ARM to OrangePi
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Release Pipeline"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.workflow_run.conclusion == 'success'
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Ansible
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y ansible
|
||||
|
||||
- name: Write SSH Key
|
||||
run: |
|
||||
echo "${{ secrets.ANSIBLE_SSH_KEY }}" > /tmp/ansible_key
|
||||
chmod 600 /tmp/ansible_key
|
||||
|
||||
- name: Write Inventory
|
||||
run: |
|
||||
printf '[orangepi]\norangepi ansible_host=%s ansible_user=%s ansible_ssh_private_key_file=/tmp/ansible_key ansible_ssh_common_args="-o StrictHostKeyChecking=no"\n' \
|
||||
"${{ secrets.ANSIBLE_HOST }}" \
|
||||
"${{ secrets.ANSIBLE_USER }}" > /tmp/inventory.ini
|
||||
|
||||
- name: Download ARM Release Artifacts
|
||||
run: |
|
||||
TAG="${{ github.event.workflow_run.head_branch }}"
|
||||
BASE_URL="${{ github.server_url }}/${{ github.repository }}/releases/download/${TAG}"
|
||||
wget -q "${BASE_URL}/brainwave-arm64.tar.gz"
|
||||
wget -q "${BASE_URL}/docker-compose.arm64.yml"
|
||||
|
||||
- name: Deploy via Ansible
|
||||
run: |
|
||||
ansible-playbook ansible/deploy.yml \
|
||||
-i /tmp/inventory.ini \
|
||||
-e "artifact_path=${{ github.workspace }}"
|
||||
|
||||
- name: Cleanup SSH Key
|
||||
if: always()
|
||||
run: rm -f /tmp/ansible_key
|
||||
Reference in new issue
Block a user