Compare commits

...

6 Commits

Author SHA1 Message Date
Kristian Freeman 599ff4dc4b Update README, better output on missing secret 2019-10-15 16:13:22 -05:00
Kristian Freeman bdf9196cd6 Update action title and description 2019-10-15 11:18:29 -05:00
Kristian Freeman 30f8ab4474 More secure wrangler dir permissions 2019-10-15 10:54:45 -05:00
Kristian Freeman f16a765f5b Add icon and color 2019-10-15 10:14:20 -05:00
Kristian Freeman 4d919731a7 Finish a thought 2019-10-14 15:58:48 -05:00
Kristian Freeman 1df1baa8d6 toml -> yaml in README 2019-10-14 15:58:01 -05:00
3 changed files with 30 additions and 27 deletions
+23 -23
View File
@@ -10,36 +10,36 @@ Add `wrangler-action` to the workflow for your Workers application. The below ex
on:
push:
branches:
- master
- master
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@master
- name: Publish
uses: signalnerve/wrangler-action@0.1.0
with:
apiKey: ${{ secrets.CLOUDFLARE_API_KEY }}
email: ${{ secrets.CLOUDFLARE_EMAIL }}
- uses: actions/checkout@master
- name: Publish
uses: signalnerve/wrangler-action@0.1.4
with:
apiKey: ${{ secrets.apiKey }}
email: ${{ secrets.email }}
```
## Configuration
You'll need to configure Wrangler using GitHub's Secrets feature - go to "Settings -> Secrets" and add your Cloudflare API key and email (for help finding these, see the [Workers documentation](https://developers.cloudflare.com/workers/quickstart/#finding-your-cloudflare-api-keys)). Your API key and email are encrypted by GitHub, and the action won't print them into logs, so they should be safe!
With your API key and email set as secrets for your repository, pass them to the action in the `with` block of your workflow:
With your API key and email set as secrets for your repository, pass them to the action in the `with` block of your workflow. Below, I've set the secret names to `apiKey` and `email`:
```yaml
jobs:
deploy:
name: Deploy
steps:
uses: signalnerve/wrangler-action@0.1.0
uses: signalnerve/wrangler-action@0.1.4
with:
apiKey: ${{ secrets.CLOUDFLARE_API_KEY }}
email: ${{ secrets.CLOUDFLARE_EMAIL }}
apiKey: ${{ secrets.apiKey }}
email: ${{ secrets.email }}
```
Optionally, you can also pass an `environment` key to the action. If you're using Wrangler's [environments](https://github.com/cloudflare/wrangler/blob/master/docs/content/environments.md) feature, you can customize _where_ the action deploys to by passing the matching environment in the `with` block of your workflow:
@@ -49,10 +49,10 @@ jobs:
deploy:
# ... previous configuration ...
steps:
uses: signalnerve/wrangler-action@0.1.0
uses: signalnerve/wrangler-action@0.1.4
with:
# ... api key and email ...
environment: "production"
environment: 'production'
```
## Troubleshooting
@@ -61,7 +61,7 @@ This action is in beta, and I'm looking for folks to use it! If something goes w
### "I just started using Workers/Wrangler and I don't know what this is!"
No problem! Check out the [Quick Start guide](https://developers.cloudflare.com/workers/quickstart) in our docs, and if you hvaen't
No problem! Check out the [Quick Start guide](https://developers.cloudflare.com/workers/quickstart) in our docs to get started. Once you have a Workers application, you may want to set it up to automatically deploy from GitHub whenever you change your project. That's where this action comes in - nice!
### "I'm trying to deploy my static site but it isn't working!"
@@ -69,18 +69,18 @@ To deploy static sites and frontend applications to Workers, check out the docum
Note that this action makes no assumptions about _how_ your project is built! **If you need to run a pre-publish step, like building your application, you need to specify a build step in your Workflow.** For instance, if I have an NPM command called `build`, my workflow TOML might resemble the following:
```toml
```yaml
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@master
- name: Build site
run: "npm run build"
- name: Publish
uses: signalnerve/wrangler-action@0.1.0
with:
apiKey: ${{ secrets.CLOUDFLARE_API_KEY }}
email: ${{ secrets.CLOUDFLARE_EMAIL }}
- uses: actions/checkout@master
- name: Build site
run: 'npm run build'
- name: Publish
uses: signalnerve/wrangler-action@0.1.4
with:
apiKey: ${{ secrets.apiKey }}
email: ${{ secrets.email }}
```
+5 -2
View File
@@ -1,5 +1,8 @@
name: 'Cloudflare Workers Deploy'
description: 'Cloudflare Workers Deploy'
name: 'Deploy to Cloudflare Workers with Wrangler'
branding:
icon: 'upload-cloud'
color: 'orange'
description: 'Deploy your Cloudflare Workers applications and sites directly from GitHub, using Wrangler'
runs:
using: 'docker'
image: 'Dockerfile'
+2 -2
View File
@@ -10,7 +10,7 @@ export WRANGLER_HOME="/github/workspace"
sanitize() {
if [ -z "${1}" ]
then
>&2 echo "Unable to find ${2}. Did you set secrets.${2}?"
>&2 echo "Unable to find ${2}. Did you add a GitHub secret called key ${2}, and pass in secrets.${2} in your workflow?"
exit 1
fi
}
@@ -20,7 +20,7 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
mkdir -p "$HOME/.wrangler"
chmod -R 777 "$HOME/.wrangler"
chmod -R 770 "$HOME/.wrangler"
sanitize "${INPUT_EMAIL}" "email"
sanitize "${INPUT_APIKEY}" "apiKey"