@eclass/semantic-release-surge
v1.1.0
Published
semantic-release plugin to publish a static site with surge.sh
Readme
@eclass/semantic-release-surge
semantic-release plugin to publish a static site with surge.sh
| Step | Description |
|--------------------|--------------------|
| verifyConditions | Verify the presence of the SURGE_TOKEN environment variable and SURGE_ALIAS environment variable or alias option. |
| prepare | Build assets with a npm script. |
| publish | Upload assets to surge.sh. |
Install
npm i -D @eclass/semantic-release-surgeUsage
The plugin can be configured in the semantic-release configuration file:
{
"plugins": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/gitlab",
"@eclass/semantic-release-surge"
]
}Configuration
Surge authentication
The surge authentication configuration is required and can be set via environment variables.
Environment variables
| Variable | Description |
| ------------- | --------------------------------------------------------------------------------------- |
| SURGE_TOKEN | Surge token created via surge token |
| SURGE_ALIAS | Optional set surge alias. Example my-awesome-project.surge.sh |
| SURGE_CNAME | Optional set surge custom CNAME. Example my-awesome-project.io |
Options
| Options | Description | Default |
|-------------------|------------------------------------------|---------|
| alias | Set de custom alias to surge.sh project. | null |
| buildScriptName | npm script to build assets. | build |
| build | Indicate if is requerid build assets. | false |
| asstes | Indicate the assets directory. | dist |
Examples
The build and asstes option can be used to skip the build assets:
{
"plugins": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/gitlab",
["@semantic-release/exec", {
"publishCmd": "npm run build"
}],
["@eclass/semantic-release-surge", {
"alias": "my-awesome-project.surge.sh",
"assets": "build",
"build": false,
}]
]
}Is posible specificate a custom npm script build and a custom CNAME:
{
"plugins": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/gitlab",
["@eclass/semantic-release-surge", {
"alias": "my-awesome-project.surge.sh",
"cname": "my-awesome-project.io",
"buildScriptName": "build:client"
}]
]
}{
"scripts": {
"build:client": "react-scripts build"
}
}