🚀 release.sh
This script automates the creation of GitHub Releases for the project. It optionally performs a build, retrieves the current version, and uploads artifacts from the dist
directory to a new GitHub Release with autogenerated notes.
The script performs the following operations:
- Environment setup:
Ensures it runs from the project root and sources environment variables from.env
if available. - Dependency checks:
Verifies thatgit
andgh
(GitHub CLI) are installed, and that the user is authenticated withgh auth login
. - Optional build:
If the-b
or--build
flag is set, runs./scripts/build.sh -c
before release. - Versioning:
Uses./scripts/get-version.sh
to determine the release version. - Release creation:
Runsgh release create v<version> ./dist/* --generate-notes
to publish a new GitHub Release with attached artifacts.
Usage:
To execute the release script, use the following command in the terminal:
Examples:
- To create a release using existing build artifacts:
./release.sh
- To build the project first, then create the release:
./release.sh -b
Notes:
- A .env file is optional but will be loaded if present.
- The dist/ directory must contain the build artifacts before release.
- The release tag will be prefixed with v (e.g., v1.2.3).