🚀 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.envif available. - Dependency checks:
Verifies thatgitandgh(GitHub CLI) are installed, and that the user is authenticated withgh auth login. - Optional build:
If the-bor--buildflag is set, runs./scripts/build.sh -cbefore release. - Versioning:
Uses./scripts/get-version.shto determine the release version. - Release creation:
Runsgh release create v<version> ./dist/* --generate-notesto 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).