diff --git a/.changeset/README.md b/.changeset/README.md index e5b6d8d..0fa3ead 100644 --- a/.changeset/README.md +++ b/.changeset/README.md @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..733e4ac --- /dev/null +++ b/CONTRIBUTING.md @@ -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. diff --git a/README.md b/README.md index 97ef9ec..f2ceed4 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: @@ -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: @@ -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. @@ -345,3 +375,7 @@ jobs: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} ``` + +``` + +```