Base template to deploy your next source function
- Click
Use This Template
above
- (If Segment PS, add to
Segment Services Engineering
Organization
nvm use
(to get the right version of NodeJS)npm install
(to install npm dependencies)
npm run test
- GitHub Actions workflow also runs tests before deploying
- Tests are created in
src/index.test.js
-
Create GitHub Environments in
Settings
→Environments
→DEV
DEV
is enabled by default in the.github/workflows/deployFunction.yml
file- (repeat for
QA
&PROD
)
-
Create Source Function in Segment Workspace
-
Connect Source Function to a Segment Source
-
Create Public API Token to allow for deploying
-
Add the following Environment Secrets
FUNCTION_ID
(include thesfnc_
part of the function id)SOURCE_ID
(available in the Source Settings → API Keys tab)PUBLIC_API_TOKEN
(Get an API Token)
- Once changes look good in the DEV environment, uncomment the QA section from
the
deployFunction.yml
file. - Push changes to your branch
- Add the label
!!_RELEASE_TO_QA
to the PR to deploy it to QA- (ensure a
QA
GitHub Environment has been created)
- (ensure a
- If ready to deploy to PROD, uncomment the PROD section from the
deployFunction.yml
file & merge the PR (ensure aPROD
GitHub Environment has been created)