Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
courtney-sims committed Nov 13, 2024
1 parent cc4ede3 commit c1338a5
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .changeset/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
with multi-package repos, or single-package repos to help you version and deploy your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
Expand Down
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Contributing Guide

## Releases

### Changesets

Every non-trivial change to the project - those that should appear in the changelog - must be captured in a "changeset". We use the changesets tool for creating changesets, publishing versions and updating the changelog.

Create a changeset for the current change.

> npx changeset
> Select which workspaces are affected by the change and whether the version requires a major, minor or patch release.
> Update the generated changeset with a description of the change.
> Include the generate changeset in the current commit.
> git add ./changeset/\*.md
### Version Packages PRs

Once you merge your PR, a new Version Packages PR will be opened in the wrangler-action repo. Once that PR is merged, your change will be released. Example: https://github.com/cloudflare/wrangler-action/pull/305

Note: Version Packages PRs are only generated if there's been at least one PR merged with a changeset.
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ jobs:
command: whoami
```

You can also add a command that spans multiple lines:

```yaml
jobs:
deploy:
steps:
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: |
pages project list
pages deploy .vercel/output/static --project-name=demo-actions --branch=test
```

## Use cases

### Deploy when commits are merged to main
Expand Down Expand Up @@ -220,7 +234,7 @@ For more advanced usage or to programmatically trigger the workflow from scripts

### Upload a Worker Version

To create a new version of your Worker that is not deployed immediately, use the `wrangler versions upload --experimental-versions` command. Worker versions created in this way can then be deployed all at once at a later time or gradually deployed using the `wranger versions deploy --experimental-versions` command or via the Cloudflare dashboard under the Deployments tab. For now, the `--experimental-versions` flag and wrangler v3.40.0 or above is required to use this feature.
To create a new version of your Worker that is not deployed immediately, use the `wrangler versions upload` command. Worker versions created in this way can then be deployed all at once at a later time or gradually deployed using the `wranger versions deploy` command or via the Cloudflare dashboard under the Deployments tab. Wrangler v3.40.0 or above is required to use this feature.

```yaml
jobs:
Expand All @@ -234,11 +248,27 @@ jobs:
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: versions upload --experimental-versions
command: versions upload
```

## Advanced Usage

### Setting A Worker Secret for A Specific Environment

There is an environment parameter that can be set within the workflow to enable this. Example:

````yaml
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --env production
secrets: |
SUPER_SECRET
environment: production
env:
SUPER_SECRET: ${{ secrets.SUPER_SECRET }}
```
### Using Wrangler Command Output in Subsequent Steps
More advanced workflows may need to parse the resulting output of Wrangler commands. To do this, you can use the `command-output` output variable in subsequent steps. For example, if you want to print the output of the Wrangler command, you can do the following:
Expand All @@ -256,7 +286,7 @@ More advanced workflows may need to parse the resulting output of Wrangler comma
env:
CMD_OUTPUT: ${{ steps.deploy.outputs.command-output }}
run: echo $CMD_OUTPUT
```
````
Now when you run your workflow, you will see the full output of the Wrangler command in your workflow logs. You can also use this output in subsequent workflow steps to parse the output for specific values.
Expand Down Expand Up @@ -345,3 +375,7 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
```

```

```

0 comments on commit c1338a5

Please sign in to comment.