Skip to content

Commit d7337f8

Browse files
committed
chore: automate release workflow
1 parent bba4bd0 commit d7337f8

5 files changed

Lines changed: 494 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
mode:
7+
description: Release mode to run
8+
required: true
9+
type: choice
10+
options:
11+
- stable
12+
- rc
13+
- canary
14+
15+
permissions:
16+
contents: write
17+
id-token: write
18+
19+
concurrency:
20+
group: release-${{ github.event.inputs.mode }}-${{ github.ref_name }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
release:
25+
name: Run release
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 20
28+
env:
29+
RELEASE_MODE: ${{ github.event.inputs.mode }}
30+
RELEASE_REF: ${{ github.ref_name }}
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
34+
NPM_CONFIG_PROVENANCE: true
35+
GIT_AUTHOR_NAME: actions-bot
36+
GIT_AUTHOR_EMAIL: actions-bot@users.noreply.github.com
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Configure git identity
44+
run: |
45+
git config user.name "$GIT_AUTHOR_NAME"
46+
git config user.email "$GIT_AUTHOR_EMAIL"
47+
48+
- name: Setup pnpm
49+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
50+
with:
51+
version: 10.6.1
52+
53+
- name: Setup Node.js
54+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
55+
with:
56+
node-version: 24.10.0
57+
cache: pnpm
58+
registry-url: https://registry.npmjs.org
59+
60+
- name: Install dependencies
61+
run: pnpm install --frozen-lockfile
62+
63+
- name: Run release
64+
run: pnpm release:run

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ This project uses GitHub Actions to run validation checks on your pull requests.
4343

4444
Currently, releases are published by maintainers when they determine it's time to do so. Usually, there is at least one release per week as long as there are changes waiting to be published.
4545

46+
The release workflow and branch conventions are documented in [RELEASING.md](/RELEASING.md).
47+
4648
## License
4749

4850
By contributing to React Native Harness, you agree that your contributions will be licensed under its MIT license.

RELEASING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Releasing
2+
3+
Releases are run with `.github/workflows/release.yml`.
4+
5+
The workflow always uses the branch it is dispatched from. There is no manual ref input.
6+
7+
## Stable releases
8+
9+
Run the workflow from `main` with `mode=stable`.
10+
11+
This applies pending version plans, publishes packages with the default npm dist-tag, pushes the release commit and tag, and creates the GitHub release.
12+
13+
## RC releases
14+
15+
Run the workflow from `release/v<version>` branches, for example `release/v1.1` or `release/v1.1.0`, with `mode=rc`.
16+
17+
`rc` mode is intentionally restricted to `release/v<version>` branches and will fail on `main`.
18+
19+
RC releases consume version plans from `.nx/version-plans`, publish packages with the `rc` dist-tag, and create a prerelease on GitHub.
20+
21+
## Canary releases
22+
23+
Run the workflow from any branch with `mode=canary`.
24+
25+
Canary releases publish a unique prerelease version for the current commit with the `canary` dist-tag. They do not create a commit, tag, or GitHub release.
26+
27+
## Required secrets
28+
29+
The workflow expects `NPM_ACCESS_TOKEN` to be configured in GitHub Actions secrets.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"build:all": "nx run-many -t build",
77
"lint:all": "nx run-many -t lint",
88
"test:all": "nx run-many -t test",
9-
"typecheck:all": "nx run-many -t typecheck"
9+
"typecheck:all": "nx run-many -t typecheck",
10+
"release:run": "node ./scripts/release/release.mjs"
1011
},
1112
"private": true,
1213
"devDependencies": {

0 commit comments

Comments
 (0)