-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
73 lines (69 loc) · 2.38 KB
/
Copy pathaction.yaml
File metadata and controls
73 lines (69 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Deploy Tailor Platform static website
description: >-
Deploy a built static website to Tailor Platform and output its public URL.
Requires Node.js, dependencies, and an active Tailor Platform session
(login is handled by the deploy action in the same job).
inputs:
workspace-id:
description: >-
Tailor Platform workspace ID to deploy to.
Set this from a GitHub Environment variable (e.g. vars.TAILOR_PLATFORM_WORKSPACE_ID).
required: true
name:
description: Static website name as defined in tailor.config.ts
required: true
dist-dir:
description: Path to the built static website files
required: true
working-directory:
description: Working directory for the project (for monorepo setups)
required: false
default: "."
package-manager:
description: >-
Package manager used to run tailor-sdk (pnpm, npm, yarn, or bun).
Defaults to npx when empty.
required: false
default: ""
outputs:
site-url:
description: Public URL of the deployed static website
value: ${{ steps.deploy.outputs.site-url }}
runs:
using: composite
steps:
- name: Resolve tailor-sdk runner
shell: bash
env:
PACKAGE_MANAGER: ${{ inputs.package-manager }}
# RUN is one of a fixed set of literals chosen by the case below (never
# user input), so writing it to GITHUB_ENV cannot inject code.
run: | # zizmor: ignore[github-env]
case "$PACKAGE_MANAGER" in
pnpm) RUN="pnpm exec" ;;
yarn) RUN="yarn" ;;
bun) RUN="bunx" ;;
npm|"") RUN="npx" ;;
*)
echo "::error::Unsupported package-manager '$PACKAGE_MANAGER' (expected pnpm, npm, yarn, or bun)"
exit 1
;;
esac
echo "TAILOR_SDK_RUN=$RUN" >> "$GITHUB_ENV"
- name: Deploy static website
id: deploy
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
WORKSPACE_ID: ${{ inputs.workspace-id }}
SITE_NAME: ${{ inputs.name }}
DIST_DIR: ${{ inputs.dist-dir }}
run: |
RESULT=$($TAILOR_SDK_RUN tailor-sdk staticwebsite deploy \
--workspace-id "$WORKSPACE_ID" \
--name "$SITE_NAME" \
--dir "$DIST_DIR" \
--json)
SITE_URL=$(echo "$RESULT" | jq -r '.url // ""')
echo "site-url=$SITE_URL" >> "$GITHUB_OUTPUT"
echo "Deployed: $SITE_URL"