Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrbradley committed Jun 18, 2024
1 parent 5a324b8 commit fb674b7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 106 deletions.
145 changes: 40 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,38 @@
[![CodeQL](https://github.com/pulumi/verify-provider-release/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/pulumi/verify-provider-release/actions/workflows/codeql-analysis.yml)
[![Coverage](./badges/coverage.svg)](./badges/coverage.svg)

## Initial Setup
Verify that a published Pulumi provider is usable from its SDK for a particular
platform.

This action performs a simple preview operation of a program having installed
the specified SDK version. This can be executed in Linux, Mac and Windows
environments to ensure cross-platform builds work correctly.

## Usage

```yaml
- uses: pulumi/verify-provider-release@v1
with:
# The runtime to test against. One of `nodejs`, `python`, `dotnet`, `go` or `java`.
runtime: 'nodejs'
# Path to a Pulumi program to use for the test.
directory: examples/simple-nodejs
# The name of the provider (excluding the publisher prefix)
provider: xyz
# The version of the provider to be tested.
providerVersion: '1.0.0'
# The version of the package to be tested. Defaults to `providerVersion`
# if not set. This must be set for Go because its versions are always a
# different format to the provider's.
packageVersion: '1.0.0'
# Template to generate the go module to be used.
# Available template fields: `{publisher}`, `{provider}`, `{moduleVersionSuffix}`
# {moduleVersionSuffix} is calculated from the provider version e.g. "/v2"
# Defaults to: `github.com/{publisher}/pulumi-{provider}/sdk{moduleVersionSuffix}`
goModuleTemplate: 'github.com/{publisher}/pulumi-{provider}/sdk{moduleVersionSuffix}'
```
## Development Setup
1. :hammer_and_wrench: Install the dependencies
Expand All @@ -33,109 +64,13 @@
...
```

## Update the Action Code

The [`src/`](./src/) directory is the heart of your action! This contains the
source code that will be run when your action is invoked. You can replace the
contents of this directory with your own code.

There are a few things to keep in mind when writing your action code:

- Most GitHub Actions toolkit and CI/CD operations are processed asynchronously.
In `main.ts`, you will see that the action is run in an `async` function.

```javascript
import * as core from '@actions/core'
//...
async function run() {
try {
//...
} catch (error) {
core.setFailed(error.message)
}
}
```

For more information about the GitHub Actions toolkit, see the
[documentation](https://github.com/pulumi/toolkit/blob/master/README.md).

For information about versioning your action, see
[Versioning](https://github.com/pulumi/toolkit/blob/master/docs/action-versioning.md)
in the GitHub Actions toolkit.

## Validate the Action

You can now validate the action by referencing it in a workflow file. For
example, [`ci.yml`](./.github/workflows/ci.yml) demonstrates how to reference an
action in the same repository.

```yaml
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Test Local Action
id: test-action
uses: ./
with:
milliseconds: 1000
- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
```

For example workflow runs, check out the
[Actions tab](https://github.com/pulumi/verify-provider-release/actions)!
:rocket:

## Usage

After testing, you can create version tag(s) that developers can use to
reference different stable versions of your action. For more information, see
[Versioning](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
in the GitHub Actions toolkit.

To include the action in a workflow in another repository, you can use the
`uses` syntax with the `@` symbol to reference a specific branch, tag, or commit
hash.

```yaml
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Test Local Action
id: test-action
uses: actions/typescript-action@v1 # Commit with the `v1` tag
with:
milliseconds: 1000
- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
```

## Publishing a New Release

This project includes a helper script, [`script/release`](./script/release)
designed to streamline the process of tagging and pushing new releases for
GitHub Actions.

GitHub Actions allows users to select a specific version of the action to use,
based on release tags. This script simplifies this process by performing the
following steps:

1. **Retrieving the latest release tag:** The script starts by fetching the most
recent release tag by looking at the local data available in your repository.
1. **Prompting for a new release tag:** The user is then prompted to enter a new
release tag. To assist with this, the script displays the latest release tag
and provides a regular expression to validate the format of the new tag.
1. **Tagging the new release:** Once a valid new tag is entered, the script tags
the new release.
1. **Pushing the new tag to the remote:** Finally, the script pushes the new tag
to the remote repository. From here, you will need to create a new release in
GitHub and users can easily reference the new tag in their workflows.
1. [Create a GitHub release](https://github.com/pulumi/verify-provider-release/releases/new)
specifying a new tag (e.g. `v1.2.3`) & generating release notes. This helps
to communicate improvements and keep a record of significant changes. We
**MUST** follow semantic versioning - only major versions can have breaking
changes.
2. Fast-forward the major version branch (e.g. `v1`) to the latest commit on the
`main` branch and push it. This is used to let our projects pin to just the
major versions and automatically recieve non-breaking changes.
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ inputs:
packageVersion:
description:
The version of the package to be tested. Defaults to `providerVersion` if
not set.
not set. This must be set for Go because its versions are always a
different format to the provider's.
publisher:
description: The publisher of the provider (if not pulumi)
default: pulumi
Expand Down

0 comments on commit fb674b7

Please sign in to comment.