Skip to main content

Before and after scripts

To define scripts that run before and/or after the script of each jobs, you can use the beforeScript and beforeScript properties.

To run a script before each job:

version: '1'
image: node:12
# run this script before each job
beforeScript:
- echo before
jobs:
build:
script:
- echo build
test:
script:
- echo test

To tun a script after each job:

version: '1'
image: node:12
# run this script before each job
afterScript:
- echo before
jobs:
build:
script:
- echo build
test:
script:
- echo test