Comments (14)
@signalnerve: Two Tills requesting this feature, must be a sign.
from wrangler-action.
@bradyjoslin this is awesome! I'm wondering if it makes more sense to have it not be wrangler subcommands, and just have a pre/post-publish inputs that you can use to execute commands inside of the wrangler-action
context. @till would be curious on your thoughts around this too
from wrangler-action.
@bradyjoslin I think that sounds great! :)
from wrangler-action.
hm, good question! you may be able to put in some shell commands after the uses: wrangler-action
step and just call wrangler directly, but i haven't tested it!
from wrangler-action.
I'm getting this error:
/home/runner/work/_temp/...673e2ea27105.sh: line 1: wrangler: command not found
Step:
- name: Clean KV cache
run: wrangler kv:key delete --binding=app cache-foo
from wrangler-action.
The action doesn't do anything besides wrangler publish
. So I have a similar request, I want to run wrangler build
only (and then deploy with Terraform). Can you extend your action to support this?
from wrangler-action.
One option for addressing would be similar to how the action was extended for secrets.
Example action yaml of implementation idea:
jobs:
deploy:
steps:
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
wrangler-commands: |
kv:namespace create "MY_KV"
kv:key put --binding=MY_KV "key" "value"
entrypoint.sh could be updated as:
# If an environment is detected as input, for each secret specified get the value of
# the matching named environment variable then configure using wrangler secret put.
if [ -z "$INPUT_ENVIRONMENT" ]
then
wrangler publish
for SECRET in $INPUT_SECRETS; do
VALUE=$(printenv "$SECRET") || secret_not_found "$SECRET"
echo "$VALUE" | wrangler secret put "$SECRET"
done
# ** New feature for handling arbitrary wrangler commands **
for COMMAND in $INPUT_WRANGLER_COMMANDS; do
wrangler "$COMMAND"
done
else
wrangler publish -e "$INPUT_ENVIRONMENT"
# ** New feature for handling arbitrary wrangler commands **
for COMMAND in $INPUT_WRANGLER_COMMANDS; do
wrangler "$COMMAND" --env "$INPUT_ENVIRONMENT"
done
fi
from wrangler-action.
@bradyjoslin, nice! Can you submit a PR?
from wrangler-action.
That's sort of pseudocode above just to express an idea, if implemented as written a few things wouldn't work right. But, if I get some time I'll try and prototype something out.
from wrangler-action.
Have a POC working with these changes.
Update to action.yaml:
...
wranglerCommands:
description: "(Advanced) A new line deliminated string of wrangler commands. Target environment must be explicitly specified."
required: false
With this update to entrypoint.sh.
...
# ** New feature for handling arbitrary wrangler commands **
printf '%s' "$INPUT_WRANGLERCOMMANDS" | while IFS= read -r COMMAND; do
OPTS=()
for OPT in $COMMAND; do
OPTS+=("$OPT")
done
wrangler "${OPTS[@]}"
OPTS=()
done
Example deployment.yml that updates two kv entries using the action:
...
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
environment: "production"
workingDirectory: "test"
secrets: SECRET1
wranglerCommands: |
kv:key put --binding=STATIC_TEST_MY_KV key value
kv:key put --binding=STATIC_TEST_MY_KV key2 value2
env:
SECRET1: ${{ secrets.SECRET1 }}
from wrangler-action.
@bradyjoslin please open a pull-request? Other people can take it on if it goes stale and you don't have the time.
from wrangler-action.
@signalnerve Well, sort of.
I need something basic like, a action: build
, and I figured I can always "include" the action multiple times (if the penalty of running or restarting it isn't too high), but see #29 for what I mean. E.g. if I wanted to kv:key put
, I would include it again in the next step.
So as long as I can e.g. not do publish
(it can be the default though), then that works. Right now this adds pre/post commands, so it's not exactly what I need.
from wrangler-action.
An idea for supporting builds without publish...
A new optional action input publish
that if set to false could skip the wrangler publish
portion of the Action's script.
That way if someone wanted to just build
, run kv
commands, or anything else, they could specify those as preCommands
or postCommands
with publish
set to false.
from wrangler-action.
@till - Awesome! PR #35 updated to include this additional option.
Set the optional publish
input to false to skip publishing your Worker project and secrets. Useful in conjunction with pre and post commands. For example, if you only wanted to run wrangler build
against your project:
jobs:
deploy:
steps:
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
publish: false
preCommands: wrangler build
from wrangler-action.
Related Issues (20)
- Cloudflare Pages Rollback HOT 2
- Unexpected behavior for pre/post commands using wrangler HOT 2
- 🐛 BUG: ✘ [ERROR] A request to the Cloudflare API ... failed. HOT 4
- Error: Package manager is not detected HOT 9
- Error Installing Wrangler with pnpm HOT 13
- Release job should not report an error when no release is expected
- test
- Add bun support
- Refactor tests to be integration tests rather than E2E deployments
- [Bug] Wrangler-action cannot detect alternative package managers when using a non-root workingDirectory HOT 4
- Wrangler is reinstalled even when it's already available HOT 2
- Errors during wrangler installation are not shown HOT 1
- No issue
- support name option HOT 1
- Unable to forward command output HOT 2
- test
- Wrangler 3.16 breaking secret uploads HOT 17
- Commands piped to Wrangler doesn't work in GitHub Actions HOT 4
- Add outputs to action HOT 2
- action doesn't use bulk secret upload when specifying wranglerVersion 3.10.0 or higher
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wrangler-action.