chore: inline deploy playbook execution

This commit is contained in:
Haitao Pan 2026-04-10 20:27:54 +08:00
parent 2baf21a251
commit ddf0fd827e
2 changed files with 18 additions and 30 deletions

View File

@ -288,6 +288,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check Out Playbooks Repository - name: Check Out Playbooks Repository
# Pull latest playbooks HEAD from the default branch.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with: with:
repository: x-evor/playbooks repository: x-evor/playbooks
@ -349,15 +350,28 @@ jobs:
"${SSH_KNOWN_HOSTS}" "${SSH_KNOWN_HOSTS}"
- name: Run Accounts Deploy Playbook - name: Run Accounts Deploy Playbook
working-directory: ${{ github.workspace }}/playbooks
env: env:
ACCOUNTS_IMAGE_REPO: ${{ needs.build.outputs.service_image_repo }} ACCOUNTS_IMAGE_REPO: ${{ needs.build.outputs.service_image_repo }}
ACCOUNTS_IMAGE_TAG: ${{ steps.deploy_image_tag.outputs.value }} ACCOUNTS_IMAGE_TAG: ${{ steps.deploy_image_tag.outputs.value }}
ACCOUNTS_PULL_IMAGE: "true" ACCOUNTS_PULL_IMAGE: "true"
run: | run: |
bash ./scripts/github-actions/deploy-accounts.sh \ set -euo pipefail
"${{ needs.prep.outputs.target_host }}" \
"${{ needs.prep.outputs.run_apply }}" \ args=(
"${GITHUB_WORKSPACE}/playbooks" ansible-playbook
-i inventory.ini
deploy_accounts_svc_plus.yml
-l "${{ needs.prep.outputs.target_host }}"
)
if [[ "${{ needs.prep.outputs.run_apply }}" != "true" ]]; then
args+=(-C)
fi
ANSIBLE_CONFIG="${PWD}/ansible.cfg" \
ACCOUNTS_PULL_IMAGE="${ACCOUNTS_PULL_IMAGE:-true}" \
"${args[@]}"
- name: Log In To Docker Hub - name: Log In To Docker Hub
if: needs.prep.outputs.run_base_images == 'true' && needs.build.outputs.base_images_pushed == 'true' if: needs.prep.outputs.run_base_images == 'true' && needs.build.outputs.base_images_pushed == 'true'

View File

@ -1,26 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
TARGET_HOST="${1:?target host is required}"
RUN_APPLY="${2:?run_apply flag is required}"
PLAYBOOK_DIR="${3:?playbook dir is required}"
test -n "${ACCOUNTS_IMAGE_REPO:-}"
test -n "${ACCOUNTS_IMAGE_TAG:-}"
cd "${PLAYBOOK_DIR}"
args=(
ansible-playbook
-i inventory.ini
deploy_accounts_svc_plus.yml
-l "${TARGET_HOST}"
)
if [[ "${RUN_APPLY}" != "true" ]]; then
args+=(-C)
fi
ANSIBLE_CONFIG="${PWD}/ansible.cfg" \
ACCOUNTS_PULL_IMAGE="${ACCOUNTS_PULL_IMAGE:-true}" \
"${args[@]}"