Skip to content

Commit 979334c

Browse files
committed
ci(release): allow deploy wait polling for docs and website
promote-docs/promote-website include a deploy_wait job that queries Actions runs; callers must grant actions: read.\n\nGrant actions: read on deploy_docs and deploy_website jobs.
1 parent 397dcc2 commit 979334c

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -337,21 +337,31 @@ jobs:
337337
run: |
338338
set -euo pipefail
339339
yarn workspace @happier-dev/cli build
340-
rm -f /tmp/happier-dev-cli-*.tgz
341-
(cd apps/cli && npm pack --silent --pack-destination /tmp)
340+
PACKAGE_NAME="$(cd apps/cli && npm pack --silent --pack-destination /tmp)"
341+
PACKAGE_FILE="/tmp/${PACKAGE_NAME}"
342+
if [ ! -f "${PACKAGE_FILE}" ]; then
343+
echo "Unable to find packed CLI tarball at ${PACKAGE_FILE}" >&2
344+
exit 1
345+
fi
342346
343-
PACKAGE_FILE="$(ls /tmp/happier-dev-cli-*.tgz 2>/dev/null | head -n 1)"
344-
if [ -z "${PACKAGE_FILE:-}" ]; then
345-
echo "Unable to find packed CLI tarball in /tmp/happier-dev-cli-*.tgz" >&2
347+
SMOKE_PREFIX="$(mktemp -d)"
348+
SMOKE_HOME="$(mktemp -d)"
349+
npm install -g --prefix "${SMOKE_PREFIX}" "${PACKAGE_FILE}"
350+
351+
HAPPIER_BIN="${SMOKE_PREFIX}/bin/happier"
352+
if [ ! -x "${HAPPIER_BIN}" ]; then
353+
echo "Expected CLI binary not found at ${HAPPIER_BIN}" >&2
346354
exit 1
347355
fi
348356
349-
npm install -g "$PACKAGE_FILE"
357+
HAPPIER_HOME_DIR="${SMOKE_HOME}" timeout 30s "${HAPPIER_BIN}" --help
358+
HAPPIER_HOME_DIR="${SMOKE_HOME}" timeout 10s "${HAPPIER_BIN}" --version
359+
DOCTOR_OUTPUT="$(HAPPIER_HOME_DIR="${SMOKE_HOME}" timeout 10s "${HAPPIER_BIN}" doctor --help)"
360+
printf '%s\n' "${DOCTOR_OUTPUT}"
350361
351-
timeout 30s happier --help
352-
timeout 10s happier --version
353-
timeout 30s happier doctor
354-
timeout 10s happier daemon status
362+
DAEMON_HELP_OUTPUT="$(HAPPIER_HOME_DIR="${SMOKE_HOME}" timeout 10s "${HAPPIER_BIN}" daemon --help)"
363+
printf '%s\n' "${DAEMON_HELP_OUTPUT}"
364+
printf '%s' "${DAEMON_HELP_OUTPUT}" | grep -q 'Daemon management'
355365
356366
- name: Compute changed components (main..dev)
357367
id: plan
@@ -847,6 +857,8 @@ jobs:
847857
deploy_website:
848858
if: always() && needs.checks.result == 'success' && inputs.dry_run != true && contains(format(',{0},', inputs.deploy_targets), ',website,') && (needs.deploy_plan.outputs.deploy_website_needed == 'true' || needs.checks.outputs.bump_website != 'none' || inputs.force_deploy == true) && (needs.bump_versions_dev.result == 'success' || needs.bump_versions_dev.result == 'skipped') && (inputs.environment != 'production' || needs.promote_main.result == 'success')
849859
needs: [checks, bump_versions_dev, promote_main, deploy_plan]
860+
permissions:
861+
actions: read
850862
uses: ./.github/workflows/promote-website.yml
851863
secrets: inherit
852864
with:
@@ -860,6 +872,8 @@ jobs:
860872
deploy_docs:
861873
if: always() && needs.checks.result == 'success' && inputs.dry_run != true && contains(format(',{0},', inputs.deploy_targets), ',docs,') && (needs.deploy_plan.outputs.deploy_docs_needed == 'true' || inputs.force_deploy == true) && (needs.bump_versions_dev.result == 'success' || needs.bump_versions_dev.result == 'skipped') && (inputs.environment != 'production' || needs.promote_main.result == 'success')
862874
needs: [checks, bump_versions_dev, promote_main, deploy_plan]
875+
permissions:
876+
actions: read
863877
uses: ./.github/workflows/promote-docs.yml
864878
secrets: inherit
865879
with:

0 commit comments

Comments
 (0)