Skip to content

Commit 0217c74

Browse files
committed
fix(ci): don't specify outdir for custom builds
1 parent a57cbda commit 0217c74

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/deploy-worker.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,19 @@ jobs:
7575
wrangler_main=$(docker run -i ghcr.io/pelletier/go-toml:v2 tomljson < wrangler.toml | jq -r '.main')
7676
echo "WRANGLER_MAIN=${wrangler_main}" >> "$GITHUB_OUTPUT"
7777
78+
- name: Check for [build] field in wrangler.toml
79+
id: check-custom-build
80+
working-directory: ${{ github.event.inputs.directory }}
81+
run: |
82+
CUSTOM_BUILD=$(docker run -i ghcr.io/pelletier/go-toml:v2 tomljson < wrangler.toml | jq -e '.build' > /dev/null && echo "true" || echo "false")
83+
echo "CUSTOM_BUILD=${CUSTOM_BUILD}" >> "$GITHUB_OUTPUT"
84+
7885
- name: Bundle/Build Worker
7986
uses: cloudflare/wrangler-action@v3
8087
with:
8188
wranglerVersion: ${{ env.wranglerVersion }}
8289
workingDirectory: ${{ github.event.inputs.directory }}
83-
command: deploy --dry-run --outdir=${{ env.outDir }} --name=${{ github.event.inputs.appId }} --dispatch-namespace ${{ github.event.inputs.dispatchNamespace }}
90+
command: deploy --dry-run ${{ steps.check-custom-build.outputs.CUSTOM_BUILD == 'false' && format('--outdir={0}', env.outDir) || '' }} --name=${{ github.event.inputs.appId }} --dispatch-namespace ${{ github.event.inputs.dispatchNamespace }}
8491

8592
- name: Deploy Worker
8693
uses: cloudflare/wrangler-action@v3
@@ -89,4 +96,4 @@ jobs:
8996
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
9097
wranglerVersion: ${{ env.wranglerVersion }}
9198
workingDirectory: ${{ github.event.inputs.directory }}
92-
command: deploy --no-bundle --name=${{ github.event.inputs.appId }} --dispatch-namespace ${{ github.event.inputs.dispatchNamespace }} ${{ env.outDir }}/${{ steps.wrangler-main.outputs.WRANGLER_MAIN }}
99+
command: deploy --no-bundle --name=${{ github.event.inputs.appId }} --dispatch-namespace ${{ github.event.inputs.dispatchNamespace }} ${{ steps.check-custom-build.outputs.CUSTOM_BUILD == 'false' && format('{0}/', env.outDir) || '' }}${{ steps.wrangler-main.outputs.WRANGLER_MAIN }}

0 commit comments

Comments
 (0)