Public Access
Release Pipeline / build-and-release (push) Successful in 4m20s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
62 lines
2.3 KiB
YAML
62 lines
2.3 KiB
YAML
name: Deploy ARM to OrangePi
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Release Pipeline"]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Ansible
|
|
run: pip3 install --quiet --break-system-packages "ansible>=9,<11"
|
|
|
|
- name: Write SSH Key
|
|
run: |
|
|
printf '%s\n' "${{ secrets.ANSIBLE_SSH_KEY }}" > /tmp/ansible_key
|
|
chmod 600 /tmp/ansible_key
|
|
|
|
- name: Write Inventory
|
|
# StrictHostKeyChecking=no is intentional for a known home-network host.
|
|
# To harden, add the host fingerprint as a secret and use a known_hosts file.
|
|
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
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SERVER_URL: ${{ github.server_url }}
|
|
REPOSITORY: ${{ github.repository }}
|
|
run: |
|
|
TAG=$(curl -sf \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
"${SERVER_URL}/api/v1/repos/${REPOSITORY}/releases?limit=1&page=1" \
|
|
| python3 -c "import sys, json; print(json.load(sys.stdin)[0]['tag_name'])")
|
|
echo "Deploying release tag: ${TAG}"
|
|
BASE_URL="${SERVER_URL}/${REPOSITORY}/releases/download/${TAG}"
|
|
wget --fail -q "${BASE_URL}/brainwave-arm64.tar.gz" || { echo "Failed to download ARM tarball from ${BASE_URL}"; exit 1; }
|
|
wget --fail -q "${BASE_URL}/docker-compose.arm64.yml" || { echo "Failed to download docker-compose file from ${BASE_URL}"; exit 1; }
|
|
|
|
- name: Deploy via Ansible
|
|
env:
|
|
WORKSPACE: ${{ github.workspace }}
|
|
run: |
|
|
ansible-playbook ansible/deploy.yml \
|
|
-i /tmp/inventory.ini \
|
|
-e "artifact_path=${WORKSPACE}"
|
|
|
|
- name: Cleanup Secrets
|
|
if: always()
|
|
run: |
|
|
rm -f /tmp/ansible_key
|
|
rm -f /tmp/inventory.ini
|