Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ jobs:
- name: Create GitHub release
env:
GH_TOKEN: ${{ fromJSON(steps.secret-service.outputs.secrets).GITHUB_TOKEN }}
run: gh release create "v${{ steps.version.outputs.version }}" --target next --generate-notes --prerelease
run: gh release create "v${{ steps.version.outputs.version }}" --target ${{ github.sha }} --generate-notes --prerelease
56 changes: 32 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,39 +134,47 @@ Here are some things to keep in mind as you file pull requests to fix bugs, add

## Release process

This guide is for maintainers who have:
This guide is for maintainers who have access to the [Forgers](https://github.com/orgs/electron/teams/forgers)
GitHub team.

- Push access to the `electron/forge` repository.
- Collaborator access to the `@electron-forge` packages on npm.
> [!IMPORTANT]
> These instructions are strictly for Electron Forge 8 pre-release versions.
> Do not use against `main`!

### 1. Prepare your local code checkout
### 1. Run the version bump script

- Switch to the tip of the `main` branch with `git switch main && git pull`.
- Run tests locally with `yarn test`.
- Check that the latest CI run passed on `main` on [GitHub](https://github.com/electron/forge/actions?query=workflow:CI).
- Remove all untracked files and directories from your checkout with `git clean -fdx`.
- Install dependencies with `yarn install`.
Run the `yarn lerna:version` script from the root of this monorepo. This script will:

### 2. Publish all npm packages
1. Reset your current git state to `HEAD`.
1. Run Lerna's [`version`](https://github.com/lerna/lerna/tree/main/libs/commands/version#readme)
command, which increments all packages to the next alpha pre-release version.
(You'll need to accept the version bump before proceeding.)
1. Check out a new branch called `alpha-release/YYMMDD-hh-mm`.
1. Commit your changes with the appropriate commit title and message.

- Log into npm with `npm login`.
- Run the `yarn lerna:publish` command.
- Enter your npm account's time-based one-time password (TOTP).
### 2. Merge the change into `next`

The `lerna:publish` script will automatically increment the next package version based on the
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard. From there, it does two things:
Push your changes up and create a new PR. **When your PR is merged, ensure that you keep the original
commit message and extended description from the original script.**

1. It creates a tagged commit that bumps the version number in `package.json` at the root and package levels
and pushes the commit and tag to GitHub.
1. It publishes every `@electron-forge/` package to npm.
> [!NOTE]
> Branch protection is configured so that only Forgers are allowed to push up commits that can
> trigger a release.

Once your PR is merged, the [`release.yml`](.github/workflows/release.yml) workflow should run.

### 3. Approve the release job

### 3. Publish release to GitHub
Look for a pending [Publish](https://github.com/electron/forge/actions?query=event%3Apush+branch%3Anext)
job in the Actions tab on the Forge repository. You need to get another Forger member to approve
the job before the publish happens.

- Go to the repo's [New Release](https://github.com/electron/forge/releases/new) page.
- Select tag you just published.
- Target the `main` branch.
- [Automatically generated release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes)
against the previous Forge release.
Once the job is completed, all `@electron-forge/` packages and `create-electron-app` should have
new published versions under the `alpha` dist-tag.

> [!NOTE]
> If the Publish job fails for whatever reason, feel free to start over at step 1. Version numbers
> aren't sacred, so we can just re-increment the release number and try again.

### Adding a new `@electron-forge` package

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build": "tsc -b packages && ts-node tools/test-dist",
"build:watch": "tsc -b packages --watch",
"docs": "yarn build && typedoc",
"lerna:version": "lerna version prerelease --force-publish --preid=alpha --no-changelog --exact --no-git-tag-version --no-push",
"lerna:version": "./tools/version.sh",
"lint:js": "prettier --check . --experimental-cli && eslint . --cache",
"lint:markdown": "electron-markdownlint \"**/*.md\"",
"lint:markdown-js": "electron-lint-markdown-standard --root . --ignore-path .markdownlintignore --semi \"**/*.md\"",
Expand Down
32 changes: 32 additions & 0 deletions tools/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e

if [ -n "$(git status --porcelain)" ]; then
echo "Error: Working directory is not clean. Please commit or stash your changes before running lerna:version."
exit 1
fi

echo "Running lerna version..."
lerna version prerelease \
--force-publish \
--preid=alpha \
--no-changelog \
--exact \
--no-git-tag-version \
--no-push

# Releaser may decline to apply version changes. Exit early in that case.
if [ -z "$(git status --porcelain)" ]; then
echo "No version changes were made. Exiting."
exit 0
fi

BRANCH_NAME="alpha-release/$(date +'%y%m%d-%I-%M')"
echo "Creating branch: $BRANCH_NAME"
git checkout -b "$BRANCH_NAME"

echo "Committing changes..."
git commit -a -m 'chore: version bump' -m '<trigger_release>'

echo "Version bump complete! Branch $BRANCH_NAME created and changes committed."