Skip to content

Commit 599c4a7

Browse files
authored
fix: propagate working-directory input to all composite action steps (#25)
Several steps that run `npx rock remote-cache` or touch `.rock/cache` were missing `working-directory`, causing `rock.config not found` errors when the app is in a subdirectory. Closes #24
1 parent 4cedf4d commit 599c4a7

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ runs:
149149
mkdir -p .rock/cache
150150
echo "{\"githubToken\": \"${{ inputs.github-token }}\"}" > .rock/cache/project.json
151151
shell: bash
152+
working-directory: ${{ inputs.working-directory }}
152153
# We create PR-related artifacts to avoid overwriting the main artifact with new JS bundle
153154
- name: Check if PR-related artifact exists
154155
if: ${{ github.event_name == 'pull_request' && inputs.re-sign == 'true' }}
@@ -163,6 +164,7 @@ runs:
163164
echo "ARTIFACT_NAME=$(echo "$OUTPUT" | jq -r '.name')" >> $GITHUB_ENV
164165
fi
165166
shell: bash
167+
working-directory: ${{ inputs.working-directory }}
166168

167169
- name: Check if regular artifact exists
168170
if: ${{ !env.ARTIFACT_NAME }}
@@ -177,6 +179,7 @@ runs:
177179
echo "ARTIFACT_NAME=$(echo "$OUTPUT" | jq -r '.name')" >> $GITHUB_ENV
178180
fi
179181
shell: bash
182+
working-directory: ${{ inputs.working-directory }}
180183
- name: Set Artifact Name (if not set)
181184
if: ${{ !env.ARTIFACT_NAME }}
182185
run: |
@@ -273,6 +276,7 @@ runs:
273276
echo BINARY_PATH $BINARY_PATH
274277
echo "ARTIFACT_PATH=$BINARY_PATH" >> $GITHUB_ENV
275278
shell: bash
279+
working-directory: ${{ inputs.working-directory }}
276280

277281
- name: Validate ELF Alignment
278282
if: ${{ inputs.validate-elf-alignment == 'true' && !env.ARTIFACT_URL && env.ARTIFACT_PATH }}
@@ -288,6 +292,7 @@ runs:
288292
BINARY_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path')
289293
echo "ARTIFACT_PATH=$BINARY_PATH" >> $GITHUB_ENV
290294
shell: bash
295+
working-directory: ${{ inputs.working-directory }}
291296

292297
- name: Re-sign Binary
293298
if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }}
@@ -341,6 +346,7 @@ runs:
341346
echo "ARTIFACT_ID=$(echo "$OUTPUT" | jq -r '.id')" >> $GITHUB_ENV
342347
fi
343348
shell: bash
349+
working-directory: ${{ inputs.working-directory }}
344350
# Special case for GitHub, as it doesn't support uploading through the API
345351
- name: Upload Artifact to GitHub
346352
id: upload-artifact
@@ -360,6 +366,7 @@ runs:
360366
OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --binary-path "${{ env.ARTIFACT_PATH }}" --json --verbose) || (echo "$OUTPUT" && exit 1)
361367
echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
362368
shell: bash
369+
working-directory: ${{ inputs.working-directory }}
363370

364371
# Upload ZIP Artifact with {fingerprint}-only name as base ZIP Artifact for caching only (first build only).
365372
# Runs only when no cached artifact exists (!ARTIFACT_URL), meaning native build was done from scratch.
@@ -373,6 +380,7 @@ runs:
373380
OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --json --verbose) || (echo "$OUTPUT" && exit 1)
374381
echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
375382
shell: bash
383+
working-directory: ${{ inputs.working-directory }}
376384

377385

378386
# Ad-hoc uploads always include an identifier in the name {identifier}-{fingerprint}
@@ -392,12 +400,14 @@ runs:
392400
OUTPUT=$(npx rock remote-cache upload --name ${{ env.ADHOC_ARTIFACT_NAME }} --binary-path "${{ env.ARTIFACT_PATH }}" --json --ad-hoc) || (echo "$OUTPUT" && exit 1)
393401
echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
394402
shell: bash
403+
working-directory: ${{ inputs.working-directory }}
395404

396405
- name: Delete Old Re-Signed Artifacts
397406
if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
398407
run: |
399408
npx rock remote-cache delete --name ${{ env.ARTIFACT_NAME }} --all-but-latest --json
400409
shell: bash
410+
working-directory: ${{ inputs.working-directory }}
401411

402412
- name: Clean Up Keystore
403413
if: ${{ (!env.ARTIFACT_URL && inputs.sign) || (env.ARTIFACT_URL && inputs.re-sign) }}

0 commit comments

Comments
 (0)