Require build artifact for deploy job

This commit is contained in:
Haitao Pan 2026-04-10 18:04:56 +08:00
parent 7cde0f9304
commit 54523d6269
2 changed files with 10 additions and 2 deletions

View File

@ -64,6 +64,8 @@ jobs:
name: Build
needs: prep
runs-on: ubuntu-latest
outputs:
artifact_name: ${{ steps.artifact_meta.outputs.artifact_name }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@ -80,10 +82,14 @@ jobs:
- name: Smoke test built artifact
run: ./dist/xworkmate-bridge --help >/dev/null
- name: Record artifact metadata
id: artifact_meta
run: echo "artifact_name=xworkmate-bridge-linux-amd64" >> "$GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: xworkmate-bridge-linux-amd64
name: ${{ steps.artifact_meta.outputs.artifact_name }}
path: dist/xworkmate-bridge
deploy:
@ -111,7 +117,7 @@ jobs:
- name: Download build artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: xworkmate-bridge-linux-amd64
name: ${{ needs.build.outputs.artifact_name }}
path: xworkmate-bridge/dist
- name: Set up Go

View File

@ -4,6 +4,7 @@ set -euo pipefail
TARGET_HOST="${1:?target host is required}"
RUN_APPLY="${2:?run_apply flag is required}"
PLAYBOOK_DIR="${3:-playbooks}"
XWORKMATE_BRIDGE_ARTIFACT_PATH="${XWORKMATE_BRIDGE_ARTIFACT_PATH:?artifact path is required}"
cd "${PLAYBOOK_DIR}"
@ -12,6 +13,7 @@ args=(
-i inventory.ini
deploy_xworkmate_bridge_vhosts.yml
-l "${TARGET_HOST}"
-e "xworkmate_bridge_artifact_path=${XWORKMATE_BRIDGE_ARTIFACT_PATH}"
)
if [[ "${RUN_APPLY}" != "true" ]]; then