This guide covers:
You can specify custom build scripts to run during different build phases by adding scripts to the repository or using special Nevercode environment files.
If you have added scripts to the repository, Nevercode will automatically detect .sh files which have been named as shown in the table below.
Working directory of all the custom build scripts is the path to the cloned repository. This means that if you need to access some files in your repository, you can use relative paths from the repository root.
Please note that multiple scripts with same name in the repository are not allowed and this will fail your build.
To add a script file:
- Navigate to the Environment page in your project settings.
- In the Environment Files section click the Add button.
- Drag and drop your file to the upload area, or click on it to browse and select from your file directory.
- Type the name of your file precisely as shown in the custom build steps table, depending on which build step should run the script.
If you have already uploaded scripts to environment files and also to your repository, then Nevercode will use files specified in the repository.
To delete a script, click the Delete icon on the right for the script you want to delete.
In the table below you can see all available build steps. Your custom build script needs to be named exactly as shown below.
Note that we expect the scripts to start with shebang line. Meaning your Bash script should have
as the first line of the script.
|Environment file key / Script name||Description|
|Run the script after the repository is cloned.|
|Run the script before the build phase is started.|
|Run the script after the build phase has finished.|
|Run the script before the test phase is started.|
|Run the script after the test phase has finished.|
|Run the script before the publishing phase is started.|
|Run the script after the publishing phase has finished.|
Let's assume that to successfully build your application various dependencies need to be installed first or some scripts have to be executed beforehand.
- Write a pre-build script (example below).
- Upload the script in the Environment Files section.
- Name the corresponding environment variable to
Updated 2 years ago