Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for running pre and post commands #35

Merged
merged 4 commits into from
Aug 21, 2020

Conversation

bradyjoslin
Copy link
Contributor

If you need to run additional shell commands before or after wrangler publish, you can specify them as input to preCommands (before publish) or postCommands (after publish). These can include additional wrangler commands (i.e. build, kv:key put) or any other commands available inside the wrangler-action context.

Sample configuration:

jobs:
  deploy:
    steps:
      uses: cloudflare/wrangler-action@1.2.0
      with:
        apiToken: ${{ secrets.CF_API_TOKEN }}
        preCommands: echo "*** pre command ***"
        postCommands: |
          echo "*** post commands ***"
          wrangler kv:key put --binding=MY_KV key2 value2
          echo "******"

Closes #25

@bradyjoslin
Copy link
Contributor Author

Added a new option to skip publishing as mentioned in #25...

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/wrangler-action@1.2.0
      with:
        apiToken: ${{ secrets.CF_API_TOKEN }}
        publish: false
        preCommands: wrangler build

@tillkruss
Copy link

How about runBefore and runAfter?

@kristianfreeman
Copy link
Contributor

kristianfreeman commented Aug 21, 2020

hey, sweet! testing this with a build: https://github.com/cloudflare/workers-docs-engine/runs/1013258180?check_suite_focus=true

edit: it worked!!

@kristianfreeman kristianfreeman merged commit 3424d15 into cloudflare:master Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running commands after publish
3 participants