In this section we will create a build workflow for compiling project code. This workflow will be configured to be executed as a job inside a CI workflow, regardless of which branch it is made on.
The creation of the GitHub action will follow the project workflow, so a new branch named feature/build-pipeline
will be created and the YAML file for the workflow will be pushed to it.
Then, a Pull Request (PR) will be created in order to merge the new branch into the appropriate branch (provided in -b
flag). The PR will be automatically merged if the repository policies are met. If the merge is not possible, either the PR URL will be shown as output, or it will be opened in your web browser if using -w
flag.
The script located at /scripts/pipelines/github/pipeline_generator.sh
will automatically create this new branch, create a build workflow based on a YAML template appropriate for the project programming language or framework, create the Pull Request and, if it is possible, merge this new branch into the specified branch.
Please note that this workflow, although manually triggerable, is designed to be executed as part of a CI workflow, which you can create following this guide.
This script will commit and push the corresponding YAML template into your repository, so please be sure your local repository is up-to-date (i.e you have pulled latest changes with git pull
).
pipeline_generator.sh \
-c <config file path> \
-n <workflow name> \
-l <language or framework> \
-d <project local path> \
[-t <target-directory>] \
[-b <branch>] \
[-w]
Note
|
The config file for the build workflow is located at /scripts/pipelines/github/templates/build/build-pipeline.cfg .
|
-c, --config-file [Required] Configuration file containing workflow definition.
-n, --pipeline-name [Required] Name that will be set to the workflow.
-l, --language [Required] Language or framework of the project.
-d, --local-directory [Required] Local directory of your project.
-t, --target-directory Target directory of build process. Takes precedence over the language/framework default one.
-b, --target-branch Name of the branch to which the Pull Request will target. PR is not created if the flag is not provided.
-w Open the Pull Request on the web browser if it cannot be automatically merged. Requires -b flag.
./pipeline_generator.sh -c ./templates/build/build-pipeline.cfg -n quarkus-project-build -l quarkus -d C:/Users/$USERNAME/Desktop/quarkus-project -b develop -w
./pipeline_generator.sh -c ./templates/build/build-pipeline.cfg -n node-project-build -l node -d C:/Users/$USERNAME/Desktop/node-project -b develop -w