Skip to content

Commit 5dbb525

Browse files
jmschneiderclaude
andcommitted
Add bundler-cache input to setup action
Lets consumers run `bundle install` (with caching) during the setup step. Needed when their `base-secrets-file` shells out to `bin/rails credentials:fetch` (or any other `bundle exec` command), since Kamal evaluates the secrets file on the runner before deploying. Threaded through the composite action, reusable workflows, and the sweep variants. Default `false`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 488adc3 commit 5dbb525

5 files changed

Lines changed: 28 additions & 1 deletion

File tree

.github/actions/setup/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ inputs:
1616
ssh-private-key:
1717
description: Private key registered with the deploy host. Loaded into ssh-agent.
1818
required: true
19+
bundler-cache:
20+
description: |
21+
When `true`, run `bundle install` (with caching) on the runner.
22+
Needed when your `base-secrets-file` shells out to `bin/rails
23+
credentials:fetch` (or any other `bundle exec` command) — Kamal
24+
evaluates the secrets file on the runner before deploying, so the
25+
runner needs the gem set installed. Default `false`.
26+
required: false
27+
default: "false"
1928
setup-buildx:
2029
description: Whether to install Docker Buildx (needed for `kamal build`).
2130
required: false
@@ -44,7 +53,7 @@ runs:
4453
uses: ruby/setup-ruby@v1
4554
with:
4655
ruby-version: ${{ inputs.ruby-version }}
47-
bundler-cache: false
56+
bundler-cache: ${{ inputs.bundler-cache }}
4857

4958
- name: Install Kamal
5059
shell: bash

.github/workflows/preview.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ on:
9696
default: 0
9797
ruby-version: { type: string, default: "3.3" }
9898
kamal-version: { type: string, default: "" }
99+
bundler-cache:
100+
description: Run `bundle install` (with caching) on the runner. Needed when `base-secrets-file` shells out to `bin/rails credentials:fetch`.
101+
type: string
102+
default: "false"
99103
ssh-user: { type: string, default: deploy }
100104
ssh-port: { type: string, default: "22" }
101105

@@ -188,6 +192,7 @@ jobs:
188192
with:
189193
ruby-version: ${{ inputs.ruby-version }}
190194
kamal-version: ${{ inputs.kamal-version }}
195+
bundler-cache: ${{ inputs.bundler-cache }}
191196
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
192197
registry-username: ${{ secrets.KAMAL_REGISTRY_USERNAME }}
193198
registry-password: ${{ secrets.KAMAL_REGISTRY_PASSWORD }}
@@ -385,6 +390,7 @@ $msg" >/dev/null || true
385390
with:
386391
ruby-version: ${{ inputs.ruby-version }}
387392
kamal-version: ${{ inputs.kamal-version }}
393+
bundler-cache: ${{ inputs.bundler-cache }}
388394
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
389395
setup-buildx: "false"
390396
setup-gha-cache: "false"

.github/workflows/sweep.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ on:
5151
prefix-strip: { type: string, default: "feature/,feat/,fix/,bug/,bugfix/,chore/,hotfix/,release/" }
5252
ruby-version: { type: string, default: "3.3" }
5353
kamal-version: { type: string, default: "" }
54+
bundler-cache:
55+
description: Run `bundle install` (with caching) on the runner. Needed when `base-secrets-file` shells out to `bin/rails credentials:fetch`.
56+
type: string
57+
default: "false"
5458
ssh-user: { type: string, default: deploy }
5559
ssh-port: { type: string, default: "22" }
5660
environment-prefix:
@@ -176,6 +180,7 @@ jobs:
176180
with:
177181
ruby-version: ${{ inputs.ruby-version }}
178182
kamal-version: ${{ inputs.kamal-version }}
183+
bundler-cache: ${{ inputs.bundler-cache }}
179184
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
180185
setup-buildx: "false"
181186
setup-gha-cache: "false"

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ inputs:
120120

121121
ruby-version: { required: false, default: "3.3" }
122122
kamal-version: { required: false, default: "" }
123+
bundler-cache:
124+
description: When `true`, runs `bundle install` (with caching) during setup. Needed if your `base-secrets-file` shells out to `bin/rails credentials:fetch` (or any other `bundle exec`) at deploy time. Default `false`.
125+
required: false
126+
default: "false"
123127
ssh-user: { required: false, default: deploy }
124128
ssh-port: { required: false, default: "22" }
125129

@@ -225,6 +229,7 @@ runs:
225229
with:
226230
ruby-version: ${{ inputs.ruby-version }}
227231
kamal-version: ${{ inputs.kamal-version }}
232+
bundler-cache: ${{ inputs.bundler-cache }}
228233
ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
229234
setup-buildx: ${{ steps.dispatch.outputs.mode == 'deploy' && 'true' || 'false' }}
230235
setup-gha-cache: ${{ steps.dispatch.outputs.mode == 'deploy' && 'true' || 'false' }}

sweep/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ inputs:
5757
prefix-strip: { required: false, default: "feature/,feat/,fix/,bug/,bugfix/,chore/,hotfix/,release/" }
5858
ruby-version: { required: false, default: "3.3" }
5959
kamal-version: { required: false, default: "" }
60+
bundler-cache: { required: false, default: "false" }
6061
ssh-user: { required: false, default: deploy }
6162
ssh-port: { required: false, default: "22" }
6263
environment-prefix: { required: false, default: "preview-" }
@@ -86,6 +87,7 @@ runs:
8687
with:
8788
ruby-version: ${{ inputs.ruby-version }}
8889
kamal-version: ${{ inputs.kamal-version }}
90+
bundler-cache: ${{ inputs.bundler-cache }}
8991
ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
9092
setup-buildx: "false"
9193
setup-gha-cache: "false"

0 commit comments

Comments
 (0)