From ddf0fd827ef1caa94116ff60673bbf9e547aefd7 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Fri, 10 Apr 2026 20:27:54 +0800 Subject: [PATCH] chore: inline deploy playbook execution --- .github/workflows/pipeline.yml | 22 +++++++++++++++---- scripts/github-actions/deploy-accounts.sh | 26 ----------------------- 2 files changed, 18 insertions(+), 30 deletions(-) delete mode 100644 scripts/github-actions/deploy-accounts.sh diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 663ef5b..00ee2d3 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -288,6 +288,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Check Out Playbooks Repository + # Pull latest playbooks HEAD from the default branch. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: repository: x-evor/playbooks @@ -349,15 +350,28 @@ jobs: "${SSH_KNOWN_HOSTS}" - name: Run Accounts Deploy Playbook + working-directory: ${{ github.workspace }}/playbooks env: ACCOUNTS_IMAGE_REPO: ${{ needs.build.outputs.service_image_repo }} ACCOUNTS_IMAGE_TAG: ${{ steps.deploy_image_tag.outputs.value }} ACCOUNTS_PULL_IMAGE: "true" run: | - bash ./scripts/github-actions/deploy-accounts.sh \ - "${{ needs.prep.outputs.target_host }}" \ - "${{ needs.prep.outputs.run_apply }}" \ - "${GITHUB_WORKSPACE}/playbooks" + set -euo pipefail + + args=( + 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 if: needs.prep.outputs.run_base_images == 'true' && needs.build.outputs.base_images_pushed == 'true' diff --git a/scripts/github-actions/deploy-accounts.sh b/scripts/github-actions/deploy-accounts.sh deleted file mode 100644 index 0c15580..0000000 --- a/scripts/github-actions/deploy-accounts.sh +++ /dev/null @@ -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[@]}"