Skip to content

Commit 58907a7

Browse files
committed
ci: make release build with read-only cache
The setup-nx-remote-cache action chose between read-write and read-only connection strings based solely on event-name, making it impossible to opt into read-only mode on a push event (e.g. a tag-triggered release calling build.yml via workflow_call). Add cache-mode to the condition so read-only is used whenever cache-mode is 'read-only', regardless of event type.
1 parent f7465ca commit 58907a7

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

.github/actions/setup-nx-remote-cache/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ runs:
2626
if: ${{ inputs.cache-mode }}
2727

2828
## Set the AZURE_STORAGE_CONNECTION_STRING.
29-
## - For `pull_request`, this comes from the passed secret.
30-
## - For `push` this is `AZURE_NX_CACHE_READWRITE_CONNECTION_STRING``.
29+
## - For `push` without `cache-mode: read-only`, this is the read-write string.
30+
## - Otherwise (pull_request, workflow_call, or explicit read-only opt-in), this is the read-only string.
3131
- run: echo AZURE_STORAGE_CONNECTION_STRING='${{ inputs.read-write-azure-connection-string }}' >> $GITHUB_ENV
3232
shell: bash
3333
name: Set AZURE_STORAGE_CONNECTION_STRING
34-
if: ${{ inputs.event-name == 'push' }}
34+
if: ${{ inputs.event-name == 'push' && inputs.cache-mode != 'read-write' }}
3535

3636
- run: echo AZURE_STORAGE_CONNECTION_STRING='${{ inputs.read-only-azure-connection-string }}' >> $GITHUB_ENV
3737
shell: bash
3838
name: Set AZURE_STORAGE_CONNECTION_STRING
39-
if: ${{ inputs.event-name != 'push' }}
39+
if: ${{ inputs.event-name != 'push' || inputs.cache-mode == 'read-only' }}

.github/workflows/build_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ jobs:
1414
ref: ${{ github.sha }}
1515
secrets:
1616
NX_KEY: ${{ secrets.NX_KEY }}
17-
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_NX_CACHE_READWRITE_CONNECTION_STRING }}
17+
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.AZURE_NX_CACHE_READONLY_CONNECTION_STRING }}

0 commit comments

Comments
 (0)