Skip to content

Commit 44d43b5

Browse files
authored
Merge pull request #2351 from actions/Link-/add-releases-docs
Add docs for the releases workflow
2 parents 22d3539 + 76ac4dd commit 44d43b5

4 files changed

Lines changed: 88 additions & 1 deletion

File tree

.github/CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@ This will ask you some questions about the new package. Start with `0.0.0` as th
5757
```
5858

5959
3. Start developing 😄.
60+
61+
## Releasing Packages
62+
63+
For information on how packages are published to npm, including workflow inputs, dist-tags, and safety guards, see the [release documentation](../docs/release.md).
64+

.github/workflows/releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
type: string
3030
required: false
3131
default: 'latest'
32-
description: 'npm dist-tag for the release. Use "latest" for main branch releases. For non-main branches, use the package major version (e.g. "v5") to avoid overwriting the latest tag.'
32+
description: 'npm dist-tag for the release. Use "latest" for main branch releases. For non-main branches, use a non-semver tag like "v1-longlived". Semver values (e.g. "5.0.0") are not valid dist-tags and will be rejected by npm.'
3333
test-all:
3434
type: boolean
3535
required: false

docs/assets/npm-dist-tags.png

170 KB
Loading

docs/release.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Releasing Packages
2+
3+
Packages are published to npm via the **Publish NPM** workflow ([`.github/workflows/releases.yml`](../.github/workflows/releases.yml)). The workflow is triggered manually through `workflow_dispatch` from the GitHub Actions UI.
4+
5+
## How it works
6+
7+
The workflow has two jobs:
8+
9+
1. **test** — Checks out the specified branch, installs dependencies, bootstraps the monorepo, builds all packages, runs tests, then packs the target package into a `.tgz` archive and uploads it as a workflow artifact.
10+
2. **publish** — Downloads the packed artifact and publishes it to npm with `--provenance` (OIDC-based). Sends a Slack notification on success or failure. Requires the `npm-publish` environment.
11+
12+
## Inputs
13+
14+
| Input | Type | Required | Default | Description |
15+
|---|---|---|---|---|
16+
| `package` | choice | **yes** || Which package to release. One of: `artifact`, `attest`, `cache`, `core`, `exec`, `github`, `glob`, `http-client`, `io`, `tool-cache`. |
17+
| `branch` | string | no | `main` | The branch to check out and release from. |
18+
| `npm-tag` | string | no | `latest` | The npm dist-tag to publish under. See [Dist-tags](#dist-tags) below. |
19+
| `test-all` | boolean | no | `false` | When `false`, only tests for the selected package are run. Set to `true` to run the full test suite across all packages. |
20+
21+
## Dist-tags
22+
23+
npm dist-tags control which version users get when they `npm install @actions/<package>` (or `@<tag>`).
24+
25+
> **Important:** npm dist-tags **cannot** be valid semver strings. Values like `5.0.0` or `1.2.3` will be rejected by npm. Use a descriptive name instead.
26+
27+
- **`latest`** — The default tag. This is what users get with a plain `npm install`. Should only be used for releases from `main`.
28+
- **Custom tags** (e.g. `v1-longlived`) — Used for releases from long-lived or experimental branches.
29+
30+
Examples of **valid** dist-tags: `latest`, `next`, `beta`, `v1-longlived`
31+
Examples of **invalid** dist-tags: `5.0.0`, `1.2.3`, `6.0.0-rc.1` (these are semver and will be rejected)
32+
33+
| ![Screenshot showcasing the npm distribution tags](assets/npm-dist-tags.png) |
34+
|---|
35+
| npm distribution tags |
36+
37+
### Safety guard
38+
39+
The workflow **blocks** publishing with the `latest` dist-tag from any branch other than `main`. This prevents accidentally overwriting `latest` with a version from an older or experimental branch. If you're releasing from a non-main branch, use the package's major version as the tag (e.g. `v5`).
40+
41+
## Examples
42+
43+
### Standard release from main
44+
45+
Use default inputs — just pick the package:
46+
47+
| Input | Value |
48+
|---|---|
49+
| `package` | `core` |
50+
| `branch` | `main` (default) |
51+
| `npm-tag` | `latest` (default) |
52+
| `test-all` | `false` (default) |
53+
54+
This publishes the version in `packages/core/package.json` on `main` as `@actions/core@latest`.
55+
56+
### Patch release from a long-lived branch
57+
58+
| Input | Value |
59+
|---|---|
60+
| `package` | `artifact` |
61+
| `branch` | `releases/v5` |
62+
| `npm-tag` | `v5` |
63+
| `test-all` | `false` (default) |
64+
65+
This publishes the version in `packages/artifact/package.json` on the `releases/v5` branch under the `v5` dist-tag. The `latest` tag remains untouched.
66+
67+
### Release with full test suite
68+
69+
| Input | Value |
70+
|---|---|
71+
| `package` | `cache` |
72+
| `branch` | `main` (default) |
73+
| `npm-tag` | `latest` (default) |
74+
| `test-all` | `true` |
75+
76+
Same as a standard release, but runs tests for all packages before publishing.
77+
78+
## Prerequisites
79+
80+
- You must have permission to trigger workflows on this repository.
81+
- The `npm-publish` environment must be configured with npm credentials and OIDC.
82+
- The `SLACK` secret must be set for Slack notifications to work.

0 commit comments

Comments
 (0)